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 f163fec8bc Add protection against watchDir and deployDir being the same
f163fec8bc is described below
commit f163fec8bc3eb66f2f870e3b7169e0a1412e575e
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jun 24 21:12:58 2026 +0100
Add protection against watchDir and deployDir being the same
---
java/org/apache/catalina/ha/deploy/FarmWarDeployer.java | 5 +++++
java/org/apache/catalina/ha/deploy/LocalStrings.properties | 1 +
2 files changed, 6 insertions(+)
diff --git a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
index 3c051fb646..91d98b994c 100644
--- a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
+++ b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
@@ -168,6 +168,9 @@ 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()));
@@ -652,6 +655,7 @@ public class FarmWarDeployer extends ClusterListener
implements ClusterDeployer,
*/
public void setDeployDir(String deployDir) {
this.deployDir = deployDir;
+ deployDirFile = null;
}
/**
@@ -718,6 +722,7 @@ public class FarmWarDeployer extends ClusterListener
implements ClusterDeployer,
*/
public void setWatchDir(String watchDir) {
this.watchDir = watchDir;
+ watchDirFile = null;
}
/**
diff --git a/java/org/apache/catalina/ha/deploy/LocalStrings.properties
b/java/org/apache/catalina/ha/deploy/LocalStrings.properties
index fc9eb8ae0f..8194e0e440 100644
--- a/java/org/apache/catalina/ha/deploy/LocalStrings.properties
+++ b/java/org/apache/catalina/ha/deploy/LocalStrings.properties
@@ -37,6 +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.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]