Author: markt
Date: Tue May 21 19:49:54 2013
New Revision: 1484919
URL: http://svn.apache.org/r1484919
Log:
Make deletion of the copied WARs used for anti-resource locking more robust if
the context fails to start (there were some circumstances where the original
WAR could get deleted).
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1484862
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1484919&r1=1484918&r2=1484919&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
Tue May 21 19:49:54 2013
@@ -231,6 +231,12 @@ public class ContextConfig implements Li
/**
+ * Anti-locking docBase
+ */
+ private String antiLockingDocBase = null;
+
+
+ /**
* Map of ServletContainerInitializer to classes they expressed interest
in.
*/
protected final Map<ServletContainerInitializer, Set<Class<?>>>
initializerClassMap =
@@ -372,16 +378,9 @@ public class ContextConfig implements Li
} else if (event.getType().equals(Lifecycle.AFTER_START_EVENT)) {
// Restore docBase for management tools
if (originalDocBase != null) {
- String docBase = context.getDocBase();
context.setDocBase(originalDocBase);
- originalDocBase = docBase;
}
} else if (event.getType().equals(Lifecycle.CONFIGURE_STOP_EVENT)) {
- if (originalDocBase != null) {
- String docBase = context.getDocBase();
- context.setDocBase(originalDocBase);
- originalDocBase = docBase;
- }
configureStop();
} else if (event.getType().equals(Lifecycle.AFTER_INIT_EVENT)) {
init();
@@ -777,11 +776,8 @@ public class ContextConfig implements Li
String docBase = context.getDocBase();
if (docBase == null)
return;
- if (originalDocBase == null) {
- originalDocBase = docBase;
- } else {
- docBase = originalDocBase;
- }
+ originalDocBase = docBase;
+
File docBaseFile = new File(docBase);
if (!docBaseFile.isAbsolute()) {
File file = new File(appBase);
@@ -811,12 +807,12 @@ public class ContextConfig implements Li
log.debug("Anti locking context[" + context.getName()
+ "] setting docBase to " + file);
+ antiLockingDocBase = file.getAbsolutePath();
// Cleanup just in case an old deployment is lying around
ExpandWar.delete(file);
if (ExpandWar.copy(docBaseFile, file)) {
- context.setDocBase(file.getAbsolutePath());
+ context.setDocBase(antiLockingDocBase);
}
-
}
}
@@ -1063,8 +1059,8 @@ public class ContextConfig implements Li
Host host = (Host) context.getParent();
String appBase = host.getAppBase();
String docBase = context.getDocBase();
- if ((docBase != null) && (originalDocBase != null)) {
- File docBaseFile = new File(docBase);
+ if (antiLockingDocBase != null) {
+ File docBaseFile = new File(antiLockingDocBase);
if (!docBaseFile.isAbsolute()) {
docBaseFile = new File(appBase, docBase);
}
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1484919&r1=1484918&r2=1484919&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue May 21 19:49:54 2013
@@ -93,6 +93,11 @@
<code>null</code> when there is no jsp configuration provided by
web.xml/web-fragment.xml. (violetagg)
</fix>
+ <fix>
+ Ensure that when Tomcat's anti-resource locking features are used
+ that the temporary copy of the web application and not the original is
+ removed when the web application stops. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]