Minor code cleanup

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1811286 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceIterator.java b/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceIterator.java
index bf37584..8038fb3 100644
--- a/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceIterator.java
+++ b/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceIterator.java
@@ -65,33 +65,26 @@
      * Creates an instance using the given parent bundle resource.
      */
     BundleResourceIterator(final BundleResource parent) {
-        // trailing slash to enumerate children
-        final String parentEntryPath = parent.getMappedPath().getEntryPath(parent.getPath().concat("/"));
-        this.prefixLength = parentEntryPath.length();
-
-        this.resourceResolver = parent.getResourceResolver();
-        this.cache = parent.getBundle();
-        this.subResources = parent.getSubResources() != null ? new HashMap<>(parent.getSubResources()) : null;
-        this.mappedPath = parent.getMappedPath();
-
-        this.entries = getFilteredEntries(parentEntryPath);
-
-        this.nextResult = (entries != null) ? seek() : null;
+        this(parent.getResourceResolver(),
+                parent.getBundle(),
+                parent.getMappedPath(),
+                parent.getPath(),
+                parent.getSubResources());
     }
 
-    BundleResourceIterator(ResourceResolver resourceResolver, BundleResourceCache bundle,
-            PathMapping mappedPath, String parentPath) {
+    BundleResourceIterator(final ResourceResolver resourceResolver,
+            final BundleResourceCache bundle,
+            final PathMapping mappedPath,
+            final String parentPath,
+            final Map<String, Map<String, Object>> subResources) {
 
         // trailing slash to enumerate children
-        if (!parentPath.endsWith("/")) {
-            parentPath = parentPath.concat("/");
-        }
-        final String parentEntryPath = mappedPath.getEntryPath(parentPath);
+        final String parentEntryPath = mappedPath.getEntryPath(parentPath.concat("/"));
         this.prefixLength = parentEntryPath.length();
 
         this.resourceResolver = resourceResolver;
         this.cache = bundle;
-        this.subResources = null;
+        this.subResources = subResources != null ? new HashMap<>(subResources) : null;
         this.mappedPath = mappedPath;
         this.entries = getFilteredEntries(parentEntryPath);
 
diff --git a/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java b/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java
index b54767c..ef504a6 100644
--- a/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java
+++ b/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java
@@ -166,7 +166,7 @@
         PathMapping mappedPath = getMappedPath(parentPath);
         if (mappedPath != null) {
             return new BundleResourceIterator(parent.getResourceResolver(),
-                cache, mappedPath, parentPath);
+                cache, mappedPath, parentPath, null);
         }
 
         // the parent resource cannot have children in this provider,