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 2014/10/17 12:29:56 UTC

svn commit: r1632529 - in /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr: JcrItemResource.java JcrNodeResourceIterator.java

Author: cziegeler
Date: Fri Oct 17 10:29:56 2014
New Revision: 1632529

URL: http://svn.apache.org/r1632529
Log:
SLING-4074 : Iterating over JCR resources might throw IllegalStateException

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

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResource.java?rev=1632529&r1=1632528&r2=1632529&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResource.java (original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResource.java Fri Oct 17 10:29:56 2014
@@ -75,13 +75,6 @@ abstract class JcrItemResource<T extends
      * @see org.apache.sling.api.resource.Resource#getPath()
      */
     public String getPath() {
-        if (path == null) {
-            try {
-                path = getItem().getPath();
-            } catch (RepositoryException e) {
-                throw new IllegalStateException("Failed to retrieve path from Item:", e);
-            }
-        }
         return path;
     }
 

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java?rev=1632529&r1=1632528&r2=1632529&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java (original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java Fri Oct 17 10:29:56 2014
@@ -91,7 +91,7 @@ public class JcrNodeResourceIterator imp
             try {
                 final Node n = nodes.nextNode();
                 Resource resource = new JcrNodeResource(resourceResolver,
-                    null, // do not eagerly initialize path due to performance considerations
+                    n.getPath(),
                     n, dynamicClassLoader);
                 LOGGER.debug("seek: Returning Resource {}", resource);
                 return resource;