Author: justin
Date: Sat Jun  5 03:24:28 2010
New Revision: 951641

URL: http://svn.apache.org/viewvc?rev=951641&view=rev
Log:
SLING-1547 - fixing resource passed to provider.listChildren()

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

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=951641&r1=951640&r2=951641&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
 Sat Jun  5 03:24:28 2010
@@ -603,7 +603,7 @@ public class JcrResourceResolver
      * @see 
org.apache.sling.api.resource.ResourceResolver#listChildren(org.apache.sling.api.resource.Resource)
      */
     @SuppressWarnings("unchecked")
-    public Iterator<Resource> listChildren(final Resource parent) {
+    public Iterator<Resource> listChildren(Resource parent) {
         checkClosed();
         final String path = parent.getPath();
         final int wsSepPos = path.indexOf(":/");
@@ -623,10 +623,14 @@ public class JcrResourceResolver
                     // this is illegal
                     return Collections.EMPTY_LIST.iterator();
                 }
+            } else if (parent instanceof WorkspaceDecoratedResource) {
+                parent = ((WorkspaceDecoratedResource) parent).getResource();
+            } else {
+                LOGGER.warn("looking for children of workspace path {}, but 
with an undecorated resource.",
+                        parent.getPath());
             }
         }
 
-
         String workspacePrefix = null;
         if ( 
!getSession().getWorkspace().getName().equals(this.factory.getDefaultWorkspaceName())
 ) {
             workspacePrefix = getSession().getWorkspace().getName();


Reply via email to