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 2015/03/03 18:55:05 UTC
svn commit: r1663754 - in /tomcat/trunk/java/org/apache/catalina/startup:
ExpandWar.java HostConfig.java
Author: markt
Date: Tue Mar 3 17:55:04 2015
New Revision: 1663754
URL: http://svn.apache.org/r1663754
Log:
Follow-up to r1663715
- use correct method to get the last modified time of the WAR
- set the directory last modified time after it has been updated
- test the correct files to see if an expanded context.xml file should be used
Modified:
tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java
tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
Modified: tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java?rev=1663754&r1=1663753&r2=1663754&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java Tue Mar 3 17:55:04 2015
@@ -84,7 +84,7 @@ public class ExpandWar {
try (JarFile jarFile = juc.getJarFile()) {
// Get the last modified time for the WAR
- long warLastModified = juc.getContentLengthLong();
+ long warLastModified = juc.getLastModified();
// Check to see of the WAR has been expanded previously
if (docBase.exists()) {
@@ -99,9 +99,8 @@ public class ExpandWar {
return (docBase.getAbsolutePath());
}
- log.info(sm.getString("expandWar.deleteOld", docBase));
-
// WAR must have been modified. Remove expanded directory.
+ log.info(sm.getString("expandWar.deleteOld", docBase));
if (!delete(docBase)) {
throw new IOException(sm.getString("expandWar.deleteFailed", docBase));
}
@@ -112,10 +111,6 @@ public class ExpandWar {
throw new IOException(sm.getString("expandWar.createFailed", docBase));
}
- // Align the last modified time of the directory with the WAR so
- // changes to the WAR while Tomcat is stopped can be detected
- docBase.setLastModified(warLastModified);
-
// Expand the WAR into the new document base directory
String canonicalDocBasePrefix = docBase.getCanonicalPath();
if (!canonicalDocBasePrefix.endsWith(File.separator)) {
@@ -161,6 +156,10 @@ public class ExpandWar {
expandedFile.setLastModified(lastModified);
}
}
+
+ // Align the last modified time of the directory with the WAR so
+ // changes to the WAR while Tomcat is stopped can be detected
+ docBase.setLastModified(warLastModified);
}
success = true;
} catch (IOException e) {
Modified: tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=1663754&r1=1663753&r2=1663754&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Tue Mar 3 17:55:04 2015
@@ -793,7 +793,10 @@ public class HostConfig
// should only be used if the directory is not out of date and
// unpackWARs is true. Note the code below may apply further limits
boolean useXml = false;
- if (xml.exists() && unpackWARs && xml.lastModified() == war.lastModified()) {
+ File expandedDir = new File(host.getAppBaseFile(), cn.getBaseName());
+ // If the xml file exists then expandedDir must exists so no need to
+ // test that here
+ if (xml.exists() && unpackWARs && expandedDir.lastModified() == war.lastModified()) {
useXml = true;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org