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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new a0dd23a7f8 Better location for validation
a0dd23a7f8 is described below

commit a0dd23a7f8e1d8c495f58fc1920d1862f408b584
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jun 24 22:40:34 2026 +0100

    Better location for validation
---
 java/org/apache/catalina/ha/deploy/FarmWarDeployer.java    | 8 +++++---
 java/org/apache/catalina/ha/deploy/LocalStrings.properties | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java 
b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
index 91d98b994c..a4b04411b8 100644
--- a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
+++ b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
@@ -168,9 +168,6 @@ public class FarmWarDeployer extends ClusterListener 
implements ClusterDeployer,
             return;
         }
         if (watchEnabled) {
-            if 
(getDeployDirFile().getCanonicalPath().equals(getWatchDirFile().getCanonicalPath()))
 {
-                throw new 
IllegalStateException(sm.getString("farmWarDeployer.samePathDeployWatch"));
-            }
             watcher = new WarWatcher(this, getWatchDirFile());
             if (log.isInfoEnabled()) {
                 log.info(sm.getString("farmWarDeployer.watchDir", 
getWatchDir()));
@@ -689,6 +686,7 @@ public class FarmWarDeployer extends ClusterListener 
implements ClusterDeployer,
      */
     public void setTempDir(String tempDir) {
         this.tempDir = tempDir;
+        tempDirFile = null;
     }
 
     /**
@@ -802,6 +800,10 @@ public class FarmWarDeployer extends ClusterListener 
implements ClusterDeployer,
      */
     protected boolean copy(File from, File to) {
         try {
+            if (from.getCanonicalPath().equals(to.getCanonicalPath())) {
+                throw new 
IOException(sm.getString("farmWarDeployer.samePathCopy"));
+            }
+
             if (!to.exists()) {
                 if (!to.createNewFile()) {
                     log.error(sm.getString("fileNewFail", to));
diff --git a/java/org/apache/catalina/ha/deploy/LocalStrings.properties 
b/java/org/apache/catalina/ha/deploy/LocalStrings.properties
index 8194e0e440..b66dee0e8d 100644
--- a/java/org/apache/catalina/ha/deploy/LocalStrings.properties
+++ b/java/org/apache/catalina/ha/deploy/LocalStrings.properties
@@ -37,7 +37,7 @@ farmWarDeployer.removeLocalFail=Unable to remove WAR file
 farmWarDeployer.removeStart=Cluster wide remove of web app [{0}]
 farmWarDeployer.removeTxMsg=Send cluster wide undeployment from [{0}]
 farmWarDeployer.renameFail=Failed to rename [{0}] to [{1}]
-farmWarDeployer.samePathDeployWatch=deployDir and watchDir must be different 
directories
+farmWarDeployer.samePathCopy=Source and destination must be different 
directories
 farmWarDeployer.sendEnd=Send cluster war deployment path [{0}], war [{1}] 
finished.
 farmWarDeployer.sendFragment=Send cluster war fragment path [{0}], war [{1}] 
to [{2}]
 farmWarDeployer.sendStart=Send cluster war deployment path [{0}], war [{1}] 
started.


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

Reply via email to