You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/06/20 18:38:41 UTC

svn commit: r1137693 - in /tomcat/trunk: java/org/apache/catalina/startup/ContextConfig.java webapps/docs/changelog.xml

Author: markt
Date: Mon Jun 20 16:38:40 2011
New Revision: 1137693

URL: http://svn.apache.org/viewvc?rev=1137693&view=rev
Log:
The fix for bug 51310 caused a regression that re-introduced bug 49957 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.

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1137693&r1=1137692&r2=1137693&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Mon Jun 20 16:38:40 2011
@@ -58,6 +58,8 @@ import org.apache.catalina.Lifecycle;
 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;
@@ -1090,6 +1092,12 @@ public class ContextConfig
         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)
@@ -1097,6 +1105,25 @@ public class ContextConfig
     }
     
     
+    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

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1137693&r1=1137692&r2=1137693&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Jun 20 16:38:40 2011
@@ -72,6 +72,12 @@
         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">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org