in src/main/java/org/apache/sling/distribution/trigger/impl/AbstractJcrEventTrigger.java [171:204]
private void addMissingPaths(Set<String> allPaths) {
Set<String> newPaths = new HashSet<String>();
for (String path : allPaths) {
for (String existingPath : allPaths) {
// in case a requested path is descendant of an existing path, also add its siblings
if (path.length() > existingPath.length() && path.startsWith(existingPath)) {
ResourceResolver resourceResolver = null;
try {
resourceResolver = DistributionUtils.loginService(resolverFactory, serviceUser);
Resource resource = resourceResolver.getResource(path);
if (resource != null) {
for (Resource child : resource.getParent().getChildren()) {
String childPath = child.getPath();
if (!childPath.equals(path)) {
newPaths.add(childPath);
}
}
} else {
throw new RuntimeException("resource at path " + path + " is null");
}
} catch (LoginException le) {
log.error("cannot obtain resource resolver for {}", serviceUser);
} finally {
DistributionUtils.safelyLogout(resourceResolver);
}
}
}
}
if (!newPaths.isEmpty()) {
allPaths.addAll(newPaths);
}
}