in src/main/java/org/apache/sling/jcr/repoinit/impl/JcrRepoInitOpsProcessorImpl.java [81:120]
private static void handleLegacyOrderingSupport(
Session session,
List<Operation> ops,
RepoInitException originalFailure,
AtomicReference<Operation> lastAttemptedOperation) {
try {
session.refresh(false); // drop transient changes
final OperationVisitor[] visitors = {
new NamespacesVisitor(session),
new NodetypesVisitor(session),
new PrivilegeVisitor(session),
new UserVisitor(session),
new NodeVisitor(session),
new AclVisitor(session),
new GroupMembershipVisitor(session),
new NodePropertiesVisitor(session)
};
for (OperationVisitor v : visitors) {
for (Operation op : ops) {
op.accept(v);
}
}
log.warn(
"DEPRECATION - The repoinit script being executed relies on a bug causing repoinit statements "
+ "to be reordered (SLING-12107). For now your repoinit script was applied successfully in legacy "
+ "mode. Please review and fix the ordering of your repoinit statements to avoid future issues. "
+ "The code supporting the legacy order will be removed in a future release. The new code "
+ "failed on the statement \"{}\". The original exception message was: {}",
Optional.ofNullable(lastAttemptedOperation.get())
.map(Operation::asRepoInitString)
.orElse("unknown"),
originalFailure.getMessage());
} catch (Exception legacyFailure) {
// rethrow the originalFailure if the legacy code also failed
throw originalFailure;
}
}