Skip to content

Commit befc49e

Browse files
committed
Better location for validation
1 parent ee7702e commit befc49e

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

java/org/apache/catalina/ha/deploy/FarmWarDeployer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@ public void start() throws Exception {
168168
return;
169169
}
170170
if (watchEnabled) {
171-
if (getDeployDirFile().getCanonicalPath().equals(getWatchDirFile().getCanonicalPath())) {
172-
throw new IllegalStateException(sm.getString("farmWarDeployer.samePathDeployWatch"));
173-
}
174171
watcher = new WarWatcher(this, getWatchDirFile());
175172
if (log.isInfoEnabled()) {
176173
log.info(sm.getString("farmWarDeployer.watchDir", getWatchDir()));
@@ -654,6 +651,7 @@ public File getTempDirFile() {
654651
*/
655652
public void setTempDir(String tempDir) {
656653
this.tempDir = tempDir;
654+
tempDirFile = null;
657655
}
658656

659657
/**
@@ -767,6 +765,10 @@ public void setMaxValidTime(int maxValidTime) {
767765
*/
768766
protected boolean copy(File from, File to) {
769767
try {
768+
if (from.getCanonicalPath().equals(to.getCanonicalPath())) {
769+
throw new IOException(sm.getString("farmWarDeployer.samePathCopy"));
770+
}
771+
770772
if (!to.exists()) {
771773
if (!to.createNewFile()) {
772774
log.error(sm.getString("fileNewFail", to));

java/org/apache/catalina/ha/deploy/LocalStrings.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ farmWarDeployer.removeLocalFail=Unable to remove WAR file
3434
farmWarDeployer.removeStart=Cluster wide remove of web app [{0}]
3535
farmWarDeployer.removeTxMsg=Send cluster wide undeployment from [{0}]
3636
farmWarDeployer.renameFail=Failed to rename [{0}] to [{1}]
37-
farmWarDeployer.samePathDeployWatch=deployDir and watchDir must be different directories
37+
farmWarDeployer.samePathCopy=Source and destination must be different directories
3838
farmWarDeployer.sendEnd=Send cluster war deployment path [{0}], war [{1}] finished.
3939
farmWarDeployer.sendFragment=Send cluster war fragment path [{0}], war [{1}] to [{2}]
4040
farmWarDeployer.sendStart=Send cluster war deployment path [{0}], war [{1}] started.

0 commit comments

Comments
 (0)