incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1511452 - /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java
Date Wed, 07 Aug 2013 19:37:03 GMT
Author: fmeschbe
Date: Wed Aug  7 19:37:03 2013
New Revision: 1511452

URL: http://svn.apache.org/r1511452
Log:
SLING-2944 Prevent NPE if there is no authenticationInfo
   is null.

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java?rev=1511452&r1=1511451&r2=1511452&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java
Wed Aug  7 19:37:03 2013
@@ -161,6 +161,12 @@ public class JcrResourceProviderFactory 
             final Map<String, Object> authenticationInfo, final boolean isAdmin)
             throws LoginException {
 
+        // TODO: Consider:
+        //        if (authenticationInfo == null) {
+        //            authenticationInfo = Collections.emptyMap();
+        //        }
+        // instead of repeated checks down the line ...
+
         // by default any session used by the resource resolver returned is
         // closed when the resource resolver is closed
         boolean logoutSession = true;
@@ -180,7 +186,9 @@ public class JcrResourceProviderFactory 
                 session = getSession(authenticationInfo);
                 if (session == null) {
 
-                    final Object serviceBundleObject = authenticationInfo.get(SERVICE_BUNDLE);
+                    final Object serviceBundleObject = (authenticationInfo != null)
+                            ? authenticationInfo.get(SERVICE_BUNDLE)
+                            : null;
                     if (serviceBundleObject instanceof Bundle) {
 
                         final String subServiceName = (authenticationInfo.get(ResourceResolverFactory.SUBSERVICE)
instanceof String)



Mime
View raw message