Author: markt Date: Tue Nov 8 09:46:58 2016 New Revision: 1768651 URL: http://svn.apache.org/viewvc?rev=1768651&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=60351 Delay creating <code>META-INF/war-tracker</code> file until after the WAR has been expanded to address the case where the Tomcat process terminates during the expansion. Also moves creation outside the loop which saves repeated calls to modify the timestamp.
Modified: tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java tomcat/trunk/webapps/docs/changelog.xml 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=1768651&r1=1768650&r2=1768651&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java Tue Nov 8 09:46:58 2016 @@ -157,9 +157,10 @@ public class ExpandWar { } try (InputStream input = jarFile.getInputStream(jarEntry)) { - if (null == input) + if (null == input) { throw new ZipException(sm.getString("expandWar.missingJarEntry", jarEntry.getName())); + } // Bugzilla 33636 expand(input, expandedFile); @@ -168,12 +169,13 @@ public class ExpandWar { expandedFile.setLastModified(lastModified); } } - - // Create the warTracker file and align the last modified time - // with the last modified time of the WAR - warTracker.createNewFile(); - warTracker.setLastModified(warLastModified); } + + // Create the warTracker file and align the last modified time + // with the last modified time of the WAR + warTracker.createNewFile(); + warTracker.setLastModified(warLastModified); + success = true; } catch (IOException e) { throw e; Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1768651&r1=1768650&r2=1768651&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Tue Nov 8 09:46:58 2016 @@ -52,6 +52,11 @@ state, or the realm backend. Update lockout realm to only register auth failures if the realm is available. (remm) </update> + <fix> + <bug>60351</bug>: Delay creating <code>META-INF/war-tracker</code> file + until after the WAR has been expanded to address the case where the + Tomcat process terminates during the expansion. (markt) + </fix> </changelog> </subsection> <subsection name="Other"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org