in src/main/java/org/apache/sling/scripting/sightly/engine/ResourceResolution.java [120:143]
private static Resource recursiveResolution(Resource base, String path) {
ResourceResolver resolver = base.getResourceResolver();
for (int iteration = 0; iteration < RECURSION_LIMIT; iteration++) {
Resource resource = null;
if (path.startsWith("/")) {
resource = getScriptResource(resolver, path);
} else {
String normalizedPath = ResourceUtil.normalize(base.getPath() + "/" + path);
if (normalizedPath != null) {
resource = getScriptResource(resolver, normalizedPath);
}
}
if (resource != null) {
return resource;
}
base = findSuperComponent(base);
if (base == null) {
return null;
}
}
//at this point we have reached recursion limit
throw new IllegalStateException("Searching for resource in component chain took more than " +
RECURSION_LIMIT + " steps");
}