This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 70ad562033 Fix BZ 68035 - allow deployment from appBase or xmlBase
70ad562033 is described below
commit 70ad562033670cea8400f9aaf848581c3fbd20ab
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Nov 6 19:40:13 2023 +0000
Fix BZ 68035 - allow deployment from appBase or xmlBase
https://bz.apache.org/bugzilla/show_bug.cgi?id=68035
---
.../apache/catalina/manager/ManagerServlet.java | 32 ++++++++++++++--------
webapps/docs/changelog.xml | 10 +++++++
2 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/java/org/apache/catalina/manager/ManagerServlet.java
b/java/org/apache/catalina/manager/ManagerServlet.java
index 096c6438ba..e0c087b587 100644
--- a/java/org/apache/catalina/manager/ManagerServlet.java
+++ b/java/org/apache/catalina/manager/ManagerServlet.java
@@ -933,25 +933,33 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
writer.println(smClient.getString("managerServlet.mkdirFail", configBase));
return;
}
- File localConfig = new File(configBase, baseName +
".xml");
- if (localConfig.isFile() && !localConfig.delete()) {
-
writer.println(smClient.getString("managerServlet.deleteFail", localConfig));
- return;
+ File localConfigFile = new File(configBase, baseName +
".xml");
+ File configFile = new File(config);
+ // Skip delete and copy if source == destination
+ if
(!configFile.getCanonicalPath().equals(localConfigFile.getCanonicalPath())) {
+ if (localConfigFile.isFile() &&
!localConfigFile.delete()) {
+
writer.println(smClient.getString("managerServlet.deleteFail",
localConfigFile));
+ return;
+ }
+ ExpandWar.copy(configFile, localConfigFile);
}
- ExpandWar.copy(new File(config), localConfig);
}
if (war != null) {
- File localWar;
+ File localWarFile;
if (war.endsWith(".war")) {
- localWar = new File(host.getAppBaseFile(),
baseName + ".war");
+ localWarFile = new File(host.getAppBaseFile(),
baseName + ".war");
} else {
- localWar = new File(host.getAppBaseFile(),
baseName);
+ localWarFile = new File(host.getAppBaseFile(),
baseName);
}
- if (localWar.exists() && !ExpandWar.delete(localWar)) {
-
writer.println(smClient.getString("managerServlet.deleteFail", localWar));
- return;
+ File warFile = new File(war);
+ // Skip delete and copy if source == destination
+ if
(!warFile.getCanonicalPath().equals(localWarFile.getCanonicalPath())) {
+ if (localWarFile.exists() &&
!ExpandWar.delete(localWarFile)) {
+
writer.println(smClient.getString("managerServlet.deleteFail", localWarFile));
+ return;
+ }
+ ExpandWar.copy(warFile, localWarFile);
}
- ExpandWar.copy(new File(war), localWar);
}
} finally {
removeServiced(name);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index ba915c7bb6..b3a972a0ea 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -192,6 +192,16 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Web applications">
+ <changelog>
+ <fix>
+ <bug>68035</bug>: Correct a regression in the fix for <bug>56248</bug>
+ that prevented deployment via the Manager of a WAR or directory that
was
+ already present in the <code>appBase</code> or a context file that was
+ already present in the <code>xmlBase</code>. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Other">
<changelog>
<add>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]