Bug 35819

Summary: Removal of WorkDir on undeploy
Product: Tomcat 5 Reporter: Rob Steele <rsteele>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 5.5.9   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   

Description Rob Steele 2005-07-21 18:00:57 UTC
When an app is undeployed via the manager (that was previously deployed with the
manager), its associated work directory is not removed from Tomcat.  This is on
Windows 2000, whether Tomcat is executed as a service OR from the command line.
 This can lead to stale JSPs being executed, among other things.

Looking at the source code, it appears as though the work dir was *intended* to
be removed when the Context is destroyed.  The following patch to the 5.5.9 code
base seems to fix the problem:

---
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java.orig
2005-03-26 13:24:02.000000000 -0500
+++
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
2005-07-15 15:00:36.156708000 -0400
@@ -1240,7 +1240,7 @@
         // Called from StandardContext.destroy()
         if (log.isDebugEnabled())
             log.debug(sm.getString("contextConfig.destroy"));
-        String workDir = ((StandardContext) context).getWorkDir();
+        String workDir = ((StandardContext) context).getWorkPath();
         if (workDir != null)
             ExpandWar.delete(new File(workDir));
     }
Comment 1 Yoav Shapira 2005-07-21 23:41:19 UTC
I've implemented this for 5.5.10: thanks for the contribution.