You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2026/06/24 20:13:46 UTC
(tomcat) branch main updated: Add protection against watchDir and deployDir being the same
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 792c1269ab Add protection against watchDir and deployDir being the same
792c1269ab is described below
commit 792c1269ab6b617384f5cc9454e52301bdc7f300
Author: Mark Thomas <ma...@apache.org>
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 f7b04b7265..20728e40e1 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()));
@@ -617,6 +620,7 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer,
*/
public void setDeployDir(String deployDir) {
this.deployDir = deployDir;
+ deployDirFile = null;
}
/**
@@ -683,6 +687,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 8b2df01de2..8de664721b 100644
--- a/java/org/apache/catalina/ha/deploy/LocalStrings.properties
+++ b/java/org/apache/catalina/ha/deploy/LocalStrings.properties
@@ -34,6 +34,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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org