You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2012/05/31 10:59:09 UTC

svn commit: r1344604 - /sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/MapEntries.java

Author: cziegeler
Date: Thu May 31 08:59:09 2012
New Revision: 1344604

URL: http://svn.apache.org/viewvc?rev=1344604&view=rev
Log:
SLING-2498 : MapEntries is unusable if something fails during init

Modified:
    sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/MapEntries.java

Modified: sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/MapEntries.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/MapEntries.java?rev=1344604&r1=1344603&r2=1344604&view=diff
==============================================================================
--- sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/MapEntries.java (original)
+++ sling/whiteboard/SLING-2396/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/MapEntries.java Thu May 31 08:59:09 2012
@@ -104,18 +104,20 @@ public class MapEntries implements Event
 
     private final ReentrantLock initializing = new ReentrantLock();
 
+    @SuppressWarnings("unchecked")
     private MapEntries() {
         this.factory = null;
         this.resolver = null;
         this.mapRoot = DEFAULT_MAP_ROOT;
 
-        this.resolveMapsMap = Collections.emptyMap();
+        this.resolveMapsMap = Collections.singletonMap(GLOBAL_LIST_KEY, (List<MapEntry>)Collections.EMPTY_LIST);
         this.mapMaps = Collections.<MapEntry> emptyList();
         this.vanityTargets = Collections.<String> emptySet();
         this.registration = null;
         this.eventAdmin = null;
     }
 
+    @SuppressWarnings("unchecked")
     public MapEntries(final ResourceResolverFactoryImpl factory, final BundleContext bundleContext, final EventAdmin eventAdmin)
                     throws LoginException {
         this.resolver = factory.getAdministrativeResourceResolver(null);
@@ -123,7 +125,7 @@ public class MapEntries implements Event
         this.mapRoot = factory.getMapRoot();
         this.eventAdmin = eventAdmin;
 
-        this.resolveMapsMap = Collections.emptyMap();
+        this.resolveMapsMap = Collections.singletonMap(GLOBAL_LIST_KEY, (List<MapEntry>)Collections.EMPTY_LIST);
         this.mapMaps = Collections.<MapEntry> emptyList();
         this.vanityTargets = Collections.<String> emptySet();