This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git


The following commit(s) were added to refs/heads/master by this push:
     new ff16b43  SLING-12651: avoid re-assignment of resolveMapsMap (#140)
ff16b43 is described below

commit ff16b436c6b363a4e5c199b5af04fe616287a8f6
Author: Julian Reschke <[email protected]>
AuthorDate: Wed Feb 12 12:34:28 2025 +0100

    SLING-12651: avoid re-assignment of resolveMapsMap (#140)
---
 .../org/apache/sling/resourceresolver/impl/mapping/MapEntries.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java 
b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
index 5434a43..2e868bc 100644
--- 
a/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
+++ 
b/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
@@ -126,7 +126,7 @@ public class MapEntries implements
 
     private volatile ServiceRegistration<ResourceChangeListener> registration;
 
-    private Map<String, List<MapEntry>> resolveMapsMap;
+    private final Map<String, List<MapEntry>> resolveMapsMap;
 
     // Temporary cache for use while doing async vanity path query
     private Map<String, List<MapEntry>> temporaryResolveMapsMap;
@@ -176,7 +176,7 @@ public class MapEntries implements
         this.factory = factory;
         this.eventAdmin = eventAdmin;
 
-        this.resolveMapsMap = Collections.singletonMap(GLOBAL_LIST_KEY, 
Collections.emptyList());
+        this.resolveMapsMap = new ConcurrentHashMap<>(Map.of(GLOBAL_LIST_KEY, 
List.of()));
         this.mapMaps = Collections.<MapEntry> emptyList();
         this.vanityTargets = Collections.<String,List <String>>emptyMap();
         this.aliasMapsMap = new ConcurrentHashMap<>();
@@ -275,8 +275,6 @@ public class MapEntries implements
                 }
             }
 
-            this.resolveMapsMap = new ConcurrentHashMap<>();
-
             doUpdateConfiguration();
 
             sendChangeEvent();

Reply via email to