in src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java [377:411]
private boolean updateResource(final String path, final AtomicBoolean resolverRefreshed) {
final boolean isValidVanityPath = this.isValidVanityPath(path);
if ( this.useOptimizeAliasResolution || isValidVanityPath) {
this.initializing.lock();
try {
this.refreshResolverIfNecessary(resolverRefreshed);
final Resource resource = this.resolver != null ? resolver.getResource(path) : null;
if (resource != null) {
boolean changed = false;
if ( isValidVanityPath ) {
// we remove the old vanity path first
changed |= doRemoveVanity(path);
// add back vanity path
Resource contentRsrc = null;
if ( !resource.getName().equals(JCR_CONTENT)) {
// there might be a JCR_CONTENT child resource
contentRsrc = resource.getChild(JCR_CONTENT);
}
changed |= doAddVanity(contentRsrc != null ? contentRsrc : resource);
}
if (this.useOptimizeAliasResolution) {
changed |= doUpdateAlias(resource);
}
return changed;
}
} finally {
this.initializing.unlock();
}
}
return false;
}