Fixed bug #51580: Severe error deploying WAR application (ExpandWar error)
authorschultz <schultz@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Sep 2011 20:30:10 +0000 (20:30 +0000)
committerschultz <schultz@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 20 Sep 2011 20:30:10 +0000 (20:30 +0000)
- Added error mesage when JarEntry InputStream cannot be found due to a broken WAR file

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1173342 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/ExpandWar.java
java/org/apache/catalina/startup/LocalStrings.properties

index f9f1b4f..c75b7e4 100644 (file)
@@ -30,6 +30,7 @@ import java.nio.channels.FileChannel;
 import java.util.Enumeration;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
+import java.util.zip.ZipException;
 
 import org.apache.catalina.Host;
 import org.apache.juli.logging.Log;
@@ -125,6 +126,9 @@ public class ExpandWar {
                 }
                 input = jarFile.getInputStream(jarEntry);
 
+                if(null == input)
+                    throw new ZipException(sm.getString("expandWar.missingJarEntry", jarEntry.getName()));
+
                 // Bugzilla 33636
                 expand(input, expandedFile);
                 long lastModified = jarEntry.getTime();
index b1f0e8a..2208705 100644 (file)
@@ -73,6 +73,7 @@ expandWar.copy=Error copying {0} to {1}
 expandWar.createFailed=Unable to create the directory [{0}]
 expandWar.deleteFailed=[{0}] could not be completely deleted. The presence of the remaining files may cause problems
 expandWar.illegalPath=The archive [{0}] is malformed and will be ignored: an entry contains an illegal path [{1}] which was not expanded to [{2}] since that is outside of the defined docBase [{3}]
+expandWar.missingJarEntry=Cannot get input stream for JarEntry "{0}" - broken WAR file?
 hostConfig.appBase=Application base [{1}] for host [{0}] does not exist or is not a directory. deployOnStartUp and autoDeploy have been set to false to prevent deployment errors. Other errors may still occur.
 hostConfig.canonicalizing=Error delete redeploy resources from context [{0}]
 hostConfig.cce=Lifecycle event data object {0} is not a Host