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

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

commit 5ec45f3aa7b815fd83a28320aca3cbb262130643
Author: opencode <[email protected]>
AuthorDate: Wed Sep 30 22:58:03 2026 +0200

    Use REPLACE_EXISTING when moving a received WAR into place in 
FarmWarDeployer since the delete of an old WAR with the same name may have 
failed
---
 java/org/apache/catalina/ha/deploy/FarmWarDeployer.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java 
b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
index 044f67b67b..989c714ecf 100644
--- a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
+++ b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
@@ -20,6 +20,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -237,7 +238,10 @@ public class FarmWarDeployer extends ClusterListener 
implements ClusterDeployer,
                             try {
                                 remove(contextName);
 
-                                Files.move(factory.getFile().toPath(), 
deployable.toPath());
+                                // Replace an existing file since the delete of
+                                // an old WAR may have failed earlier
+                                Files.move(factory.getFile().toPath(), 
deployable.toPath(),
+                                        StandardCopyOption.REPLACE_EXISTING);
                             } catch (IOException ioe) {
                                 
log.error(sm.getString("farmWarDeployer.renameFail", factory.getFile(), 
deployable),
                                         ioe);


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

Reply via email to