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 41e5f87b37 Follow-on to antiResourceLocking improvements
41e5f87b37 is described below
commit 41e5f87b37f93c17855205174ffa23a4d2db817d
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Jun 26 21:16:34 2026 +0100
Follow-on to antiResourceLocking improvements
---
java/org/apache/catalina/startup/ContextConfig.java | 10 ++++------
java/org/apache/catalina/startup/ExpandWar.java | 2 +-
webapps/docs/config/context.xml | 6 ++++++
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/java/org/apache/catalina/startup/ContextConfig.java
b/java/org/apache/catalina/startup/ContextConfig.java
index 2eb1636b98..78734195af 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -214,8 +214,8 @@ public class ContextConfig implements LifecycleListener {
/**
- * Anti-locking docBase. It is a path to a copy of the web application in
the java.io.tmpdir directory. This path is
- * always an absolute one.
+ * Anti-locking docBase. This is a path to a copy of the web application
located in a temporary directory under the
+ * default JVM temporary directory. This path is always an absolute one.
*/
private File antiLockingDocBase = null;
@@ -966,8 +966,8 @@ public class ContextConfig implements LifecycleListener {
} else {
antiLockingDocBase =
Files.createTempDirectory(prefix).toFile();
}
- } catch (IOException ioe) {
- log.error(sm.getString("contextConfig.noAntiLocking",
context.getName()), ioe);
+ } catch (IllegalArgumentException | IOException e) {
+ log.error(sm.getString("contextConfig.noAntiLocking",
context.getName()), e);
return;
}
antiLockingDocBase = antiLockingDocBase.getAbsoluteFile();
@@ -976,8 +976,6 @@ public class ContextConfig implements LifecycleListener {
log.debug(sm.getString("contextConfig.antiLocking",
context.getName(), antiLockingDocBase.getPath()));
}
- // Cleanup just in case an old deployment is lying around
- ExpandWar.delete(antiLockingDocBase);
if (ExpandWar.copy(docBaseFile, antiLockingDocBase)) {
context.setDocBase(antiLockingDocBase.getPath());
}
diff --git a/java/org/apache/catalina/startup/ExpandWar.java
b/java/org/apache/catalina/startup/ExpandWar.java
index 0e783a1e25..1ea7cf0da7 100644
--- a/java/org/apache/catalina/startup/ExpandWar.java
+++ b/java/org/apache/catalina/startup/ExpandWar.java
@@ -237,7 +237,7 @@ public class ExpandWar {
String[] files;
if (src.isDirectory()) {
files = src.list();
- result = dest.mkdir();
+ result = dest.isDirectory() || dest.mkdir();
} else {
files = new String[1];
files[0] = "";
diff --git a/webapps/docs/config/context.xml b/webapps/docs/config/context.xml
index 193b6cf3f5..bb4a82d651 100644
--- a/webapps/docs/config/context.xml
+++ b/webapps/docs/config/context.xml
@@ -842,6 +842,12 @@
be <strong>deleted</strong> on Tomcat shutdown. You probably don't
want
to do this, so think twice before setting antiResourceLocking=true on a
webapp that's outside the <code>appBase</code> for its Host.</p>
+
+ <p>If Tomcat terminates abnormally, the temporary copy of the web
+ application will not be deleted and must be cleaned-up manually. It
will
+ be in the JVM default temporary directory. If Tomcat has been
restarted,
+ take care to check the timestamps before deleting any web application
+ copies to make sure you are not deleting any currently in use.</p>
</attribute>
<attribute name="clearReferencesHttpClientKeepAliveThread"
required="false">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]