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

markt-asf pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 224d0aef20 Fix potential race
224d0aef20 is described below

commit 224d0aef20e8327c4a5e7c273d093936617cc0a2
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 4dbf4fef4a..0ef96d7325 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -2988,12 +2988,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