From 3b7c30a7443fca14269a94e43caa80b7f17e48f6 Mon Sep 17 00:00:00 2001 From: Julian Reschke Date: Thu, 19 Dec 2024 12:29:14 +0100 Subject: [PATCH] OAK-11311: Remove usage of Guava ImmutableList - oak-security-spi - make a few lists unmodifiable --- .../oak/spi/security/CompositeConfiguration.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java b/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java index 18f5b4a63e2..e0dd31f5ee0 100644 --- a/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java +++ b/oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java @@ -44,6 +44,7 @@ import org.osgi.framework.Constants; import java.security.Principal; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; @@ -220,20 +221,21 @@ public RepositoryInitializer getRepositoryInitializer() { public List getCommitHooks(@NotNull final String workspaceName) { Iterable t = Iterables.concat(Lists.transform(getConfigurations(), securityConfiguration -> securityConfiguration.getCommitHooks(workspaceName))); - return CollectionUtils.toList(t); + return Collections.unmodifiableList(CollectionUtils.toList(t)); } @NotNull @Override public List getValidators(@NotNull final String workspaceName, @NotNull final Set principals, @NotNull final MoveTracker moveTracker) { Iterable t = Iterables.concat(Lists.transform(getConfigurations(), securityConfiguration -> securityConfiguration.getValidators(workspaceName, principals, moveTracker))); - return CollectionUtils.toList(t); + return Collections.unmodifiableList(CollectionUtils.toList(t)); } @NotNull @Override public List getConflictHandlers() { - return CollectionUtils.toList(Iterables.concat(Lists.transform(getConfigurations(), securityConfiguration -> securityConfiguration.getConflictHandlers()))); + return CollectionUtils.toList(Iterables.concat(Lists.transform(getConfigurations(), + securityConfiguration -> securityConfiguration.getConflictHandlers()))); } @NotNull @@ -241,7 +243,7 @@ public List getConflictHandlers() { public List getProtectedItemImporters() { Iterable t = Iterables.concat(Lists.transform(getConfigurations(), securityConfiguration -> securityConfiguration.getProtectedItemImporters())); - return CollectionUtils.toList(t); + return Collections.unmodifiableList(CollectionUtils.toList(t)); } @NotNull