SLING-1733 - BundleResourceProvider would fail to find resources when multiple bundles had the same Sling-Bundle-Resources path
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@993606 13f79535-47bb-0310-9956-ffa450edef68
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 8e2e285..72870b6 100644
--- a/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java
+++ b/src/main/java/org/apache/sling/bundleresource/impl/BundleResourceProvider.java
@@ -114,10 +114,11 @@
public Iterator<Resource> listChildren(final Resource parent)
throws SlingException {
- // bundle resources can handle this request directly
- if (parent instanceof BundleResource) {
- return ((BundleResource) parent).listChildren();
- }
+ if (((BundleResource)parent).getBundle() == this.bundle) {
+ // bundle resources can handle this request directly when the parent
+ // resource is in the same bundle as this provider.
+ return ((BundleResource) parent).listChildren();
+ }
// ensure this provider may have children of the parent
String parentPath = parent.getPath();