akankshajain18 commented on a change in pull request #24:
URL: 
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/24#discussion_r534125889



##########
File path: 
src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
##########
@@ -313,21 +306,21 @@ protected void activate(final BundleContext 
bundleContext, final ResourceResolve
         }
 
         // optimize alias path allow list
-        this.aliasPathAllowList = null;
-        String[] aliasPathPrefix = 
config.resource_resolver_optimize_alias_allowlist();
+        String[] aliasPathPrefix = 
config.resource_resolver_allowed_alias_locations();
         if ( aliasPathPrefix != null ) {
-            final List<String> prefixList = new ArrayList<>();
-            for(final String value : aliasPathPrefix) {
-                if ( value.trim().length() > 0 ) {
-                    if ( value.trim().endsWith("/") ) {
-                        prefixList.add(value.trim());
+            final Set<String> prefixSet = new HashSet<>();
+            for(final String prefix : aliasPathPrefix) {
+                String value = prefix.trim();
+                if (!value.isEmpty()) {
+                    if ( value.endsWith("/") ) {
+                        prefixSet.add(value);
                     } else {
-                        prefixList.add(value.trim() + "/");
+                        prefixSet.add(value + "/");
                     }
                 }
             }
-            if ( !prefixList.isEmpty()) {
-                this.aliasPathAllowList = new AtomicReferenceArray<>( 
prefixList.toArray(new String[prefixList.size()]));
+            if ( !prefixSet.isEmpty()) {
+                this.aliasPathAllowList = new 
CopyOnWriteArrayList<>(prefixSet);

Review comment:
       So basically while declaring the CopyOnWriteArrayList, initialization is 
done and in later parts, add /clear method should be used.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to