incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r618598 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Date Tue, 05 Feb 2008 10:07:30 GMT
Author: cziegeler
Date: Tue Feb  5 02:07:28 2008
New Revision: 618598

URL: http://svn.apache.org/viewvc?rev=618598&view=rev
Log:
Prevent NPE (see SLING-220)

Modified:
    incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java

Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=618598&r1=618597&r2=618598&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
(original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Tue Feb  5 02:07:28 2008
@@ -76,12 +76,12 @@
 
     public Resource resolve(HttpServletRequest request) throws SlingException {
         String pathInfo = request.getPathInfo();
-        
+
         // servlet directly address, so there is no path info, use "/" then
         if (pathInfo == null) {
             pathInfo = "/";
         }
-        
+
         Resource result = resolve(pathInfo, request.getMethod());
 
         if (result == null) {
@@ -100,7 +100,7 @@
         // TODO for now use null as a method to make sure this goes up the path
         // (see SLING-179)
         return resolve(uri, null);
-        
+
     }
 
     public String map(String resourcePath) {
@@ -130,7 +130,7 @@
     }
 
     public Resource getResource(String path) {
-        
+
         // if the path is absolute, normalize . and .. segements and get res
         if (path.startsWith("/")) {
             path = JcrResourceUtil.normalize(path);
@@ -145,13 +145,13 @@
                 return res;
             }
         }
-        
+
         // no resource found, if we get here
         return null;
      }
 
     public Resource getResource(Resource base, String path) {
-        
+
         if (!path.startsWith("/") && base != null) {
             path = base.getPath() + "/" + path;
         }
@@ -162,7 +162,7 @@
     public String[] getSearchPath() {
         return factory.getSearchPath().clone();
     }
-    
+
     public Iterator<Resource> listChildren(Resource parent) {
         if (parent instanceof Descendable) {
             return ((Descendable) parent).listChildren();
@@ -357,7 +357,10 @@
 
         ResourceProviderEntry rp = rootProvider.getResourceProvider(path);
         while (rp != null && resource == null) {
-            resource = rp.getResourceProvider().getResource(path);
+            // resource provider can be null (TODO - why?)
+            if ( rp.getResourceProvider() != null ) {
+                resource = rp.getResourceProvider().getResource(path);
+            }
             rp = rp.getParentEntry();
         }
 



Mime
View raw message