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

markt-asf 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 a56abb3dee Fix potential race
a56abb3dee is described below

commit a56abb3dee549d6b71469108a4842259376729d3
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Jun 15 10:41:05 2026 +0100

    Fix potential race
---
 java/org/apache/catalina/servlets/WebdavServlet.java | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index ce6a43568e..4e9ca03f3f 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2983,12 +2983,8 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
         @Override
         public void copy(String source, String destination) {
             ArrayList<Node> properties = deadProperties.get(source);
-            ArrayList<Node> propertiesDest = deadProperties.get(destination);
             if (properties != null) {
-                if (propertiesDest == null) {
-                    propertiesDest = new ArrayList<>();
-                    deadProperties.put(destination, propertiesDest);
-                }
+                ArrayList<Node> propertiesDest = 
deadProperties.computeIfAbsent(destination, k -> new ArrayList<>());
                 /*
                  * The following ensures that locks for any two paths are 
always obtained in the same order regardless
                  * of which is the source and which is the destination. This 
is to avoid deadlocks for concurrent calls


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to