Revert "SLING-7593 : ResourceTraversor doesn't support ResourceDecorator pattern. Apply patch from Joanna Jasnowska"
This reverts commit 292c461f6223865026c8522ac5167a042a168854.
This change has introduced a regression in the way missing resources
with existing children are rendered, see SLING-7833 for details.
diff --git a/src/main/java/org/apache/sling/api/resource/ResourceUtil.java b/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
index c1a0738..fdbcc29 100644
--- a/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
+++ b/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
@@ -373,7 +373,12 @@
*/
@Deprecated
public static @NotNull Iterator<Resource> listChildren(@NotNull Resource parent) {
- return parent.listChildren();
+ /*
+ * Same as AbstractResource.listChildren() implementation to prevent
+ * problems if there are implementations of the pre-2.1.0 Resource
+ * interface in the framework.
+ */
+ return parent.getResourceResolver().listChildren(parent);
}
/**
@@ -466,9 +471,9 @@
* to go up the resource super type hierarchy.
*
* In case the type of the given resource or the given resource type starts with one of the resource resolver's search paths
- * it is converted to a relative resource type by stripping off the resource resolver's search path
+ * it is converted to a relative resource type by stripping off the resource resolver's search path
* before doing the comparison.
- *
+ *
* @param resource the resource to check
* @param resourceType the resource type to check the resource against
* @return <code>false</code> if <code>resource</code> is <code>null</code>.