Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 204DC6350 for ; Mon, 20 Jun 2011 16:39:05 +0000 (UTC) Received: (qmail 98021 invoked by uid 500); 20 Jun 2011 16:39:04 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 97955 invoked by uid 500); 20 Jun 2011 16:39:04 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 97946 invoked by uid 99); 20 Jun 2011 16:39:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2011 16:39:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2011 16:39:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1AC4823889B2; Mon, 20 Jun 2011 16:38:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1137693 - in /tomcat/trunk: java/org/apache/catalina/startup/ContextConfig.java webapps/docs/changelog.xml Date: Mon, 20 Jun 2011 16:38:41 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110620163841.1AC4823889B2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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) + + 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. (mark) + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org