import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Pipeline;
+import org.apache.catalina.Server;
+import org.apache.catalina.Service;
import org.apache.catalina.Valve;
import org.apache.catalina.Wrapper;
import org.apache.catalina.core.ContainerBase;
if (log.isDebugEnabled())
log.debug(sm.getString("contextConfig.destroy"));
+ // Skip clearing the work directory if Tomcat is being shutdown
+ Server s = getServer();
+ if (s != null && !s.getState().isAvailable()) {
+ return;
+ }
+
// Changed to getWorkPath per Bugzilla 35819.
String workDir = ((StandardContext) context).getWorkPath();
if (workDir != null)
}
+ private Server getServer() {
+ Container c = context;
+ while (c != null && !(c instanceof Engine)) {
+ c = c.getParent();
+ }
+
+ if (c == null) {
+ return null;
+ }
+
+ Service s = ((Engine)c).getService();
+
+ if (s == null) {
+ return null;
+ }
+
+ return s.getServer();
+ }
+
/**
* Validate the usage of security role names in the web application
* deployment descriptor. If any problems are found, issue warning
Add the Tomcat extras JARs to the list of JARs to skip when scanning
for TLDs and web fragments. (rjung)
</update>
+ <fix>
+ The fix for bug <bug>51310</bug> caused a regression that re-introduced
+ bug <bug>49957</bug> and deleted the contents of the work directory
+ when Tomcat was shutdown. This fix ensures that that work directory for
+ an application is not deleted when Tomcat is shutdown. (mark)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">