sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1238455 - /sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java
Date Tue, 31 Jan 2012 12:44:20 GMT
Author: cziegeler
Date: Tue Jan 31 12:44:20 2012
New Revision: 1238455

URL: http://svn.apache.org/viewvc?rev=1238455&view=rev
Log:
SLING-2254 : ConcurrentModificationException in AdapterManagerImpl.createAdapterFactoryMap.
Apply patch from Felix

Modified:
    sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java

Modified: sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java?rev=1238455&r1=1238454&r2=1238455&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java
(original)
+++ sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java
Tue Jan 31 12:44:20 2012
@@ -67,7 +67,7 @@ import org.slf4j.LoggerFactory;
 public class AdapterManagerImpl implements AdapterManager {
 
     private Logger log = LoggerFactory.getLogger(getClass());
-    
+
     /**
      * The OSGi <code>ComponentContext</code> to retrieve
      * {@link AdapterFactory} service instances.
@@ -365,18 +365,17 @@ public class AdapterManagerImpl implemen
         Map<String, AdapterFactory> afm = new HashMap<String, AdapterFactory>();
 
         // AdapterFactories for this class
-        AdapterFactoryDescriptorMap afdMap;
         synchronized (factories) {
-            afdMap = factories.get(clazz.getName());
-        }
-        if (afdMap != null) {
-            for (AdapterFactoryDescriptor afd : afdMap.values()) {
-                String[] adapters = afd.getAdapters();
-                for (String adapter : adapters) {
-                    if (!afm.containsKey(adapter)) {
-                        final AdapterFactory factory = afd.getFactory();
-                        if ( factory != null ) {
-                            afm.put(adapter, factory);
+            AdapterFactoryDescriptorMap afdMap = factories.get(clazz.getName());
+            if (afdMap != null) {
+                for (AdapterFactoryDescriptor afd : afdMap.values()) {
+                    String[] adapters = afd.getAdapters();
+                    for (String adapter : adapters) {
+                        if (!afm.containsKey(adapter)) {
+                            final AdapterFactory factory = afd.getFactory();
+                            if (factory != null) {
+                                afm.put(adapter, factory);
+                            }
                         }
                     }
                 }



Mime
View raw message