incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From my...@apache.org
Subject svn commit: r1490527 - in /sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl: helper/SortedProviderList.java tree/RootResourceProviderEntry.java
Date Fri, 07 Jun 2013 07:28:55 GMT
Author: mykee
Date: Fri Jun  7 07:28:55 2013
New Revision: 1490527

URL: http://svn.apache.org/r1490527
Log:
SLING-2915 - Infrequent NPE in resourceresolver

Modified:
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/SortedProviderList.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/SortedProviderList.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/SortedProviderList.java?rev=1490527&r1=1490526&r2=1490527&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/SortedProviderList.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/SortedProviderList.java
Fri Jun  7 07:28:55 2013
@@ -188,7 +188,7 @@ public class SortedProviderList<T> {
     /**
      * returns the ProviderHandler for a specific resource provider
      */
-    public ProviderHandler getProviderHandler ( ResourceProvider resourceProvider )
+    public ProviderHandler getProviderHandler ( ResourceResolverContext ctx, ResourceProvider
resourceProvider )
     {
         ProviderHandler returnValue = null;
         final List<Entry> list = new ArrayList<Entry>();
@@ -196,7 +196,7 @@ public class SortedProviderList<T> {
         final Iterator<Entry> i = list.iterator();
         while ( i.hasNext() ) {
             final Entry entry = i.next();
-            if ( entry.handler.equals(resourceProvider) ) {
+            if ( entry.handler.getResourceProvider(ctx).equals(resourceProvider) ) {
                 returnValue = entry.handler;
                 break;
             }

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java?rev=1490527&r1=1490526&r2=1490527&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java
Fri Jun  7 07:28:55 2013
@@ -136,6 +136,8 @@ public class RootResourceProviderEntry e
             private Iterator<Resource> nextResourceIter;
             
             private ProviderHandler actProviderHandler;
+            
+            private ResourceResolverContext rrCtx = ctx; 
 
             private Resource seek() {
                 Resource result = null;
@@ -144,14 +146,16 @@ public class RootResourceProviderEntry e
                     while ( i.hasNext() && nextResourceIter == null ) {
                         final QueriableResourceProvider adap = i.next();
                         nextResourceIter = adap.findResources(resolver, query, language);
-                        actProviderHandler = queriableProviders.getProviderHandler(adap);
+                        actProviderHandler = queriableProviders.getProviderHandler(rrCtx,
adap);
                     }
                 }
                 if ( nextResourceIter != null ) {
                     while ( nextResourceIter.hasNext() && result == null ) {
                         result = nextResourceIter.next();
                     }
-                    result = actProviderHandler.getReadableResource(ctx, result);
+                    if ( actProviderHandler != null ) {
+                        result = actProviderHandler.getReadableResource(ctx, result);
+                    }
                     if ( result == null ) {
                         result = seek();
                     }



Mime
View raw message