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

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 7758141471 Sync in needed to iterate safely over 
Collections.synchronizedList
7758141471 is described below

commit 7758141471e8e126b81c9aed8dcf60e30bdfb155
Author: remm <r...@apache.org>
AuthorDate: Tue Sep 3 11:35:37 2024 +0200

    Sync in needed to iterate safely over Collections.synchronizedList
    
    As a result it is likely simpler to use CopyOnWriteArrayList instead.
    Also make types more explicit (see if it makes Coverity happier).
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index 60076f8b27..f3280fde49 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -218,7 +218,7 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
      * Key : path <br>
      * Value : LockInfo
      */
-    private final Map<String,LockInfo> resourceLocks = new 
ConcurrentHashMap<>();
+    private final ConcurrentHashMap<String,LockInfo> resourceLocks = new 
ConcurrentHashMap<>();
 
 
     /**
@@ -228,13 +228,13 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
      * Value : List of lock-null resource which are members of the collection. 
Each element of the List is the path
      * associated with the lock-null resource.
      */
-    private final Map<String,List<String>> lockNullResources = new 
ConcurrentHashMap<>();
+    private final ConcurrentHashMap<String,CopyOnWriteArrayList<String>> 
lockNullResources = new ConcurrentHashMap<>();
 
 
     /**
      * List of the inheritable collection locks.
      */
-    private final List<LockInfo> collectionLocks = 
Collections.synchronizedList(new ArrayList<>());
+    private final CopyOnWriteArrayList<LockInfo> collectionLocks = new 
CopyOnWriteArrayList<>();
 
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to