Author: markt
Date: Mon Nov 4 23:52:45 2013
New Revision: 1538806
URL: http://svn.apache.org/r1538806
Log:
Enable the JAR implementation for JARs in packed WARs to correctly handle
multiple calls to methods
Modified:
tomcat/trunk/java/org/apache/tomcat/util/scan/FileUrlNestedJar.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/FileUrlNestedJar.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/FileUrlNestedJar.java?rev=1538806&r1=1538805&r2=1538806&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/FileUrlNestedJar.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/FileUrlNestedJar.java Mon Nov
4 23:52:45 2013
@@ -47,8 +47,6 @@ public class FileUrlNestedJar implements
int pathStart = urlAsString.indexOf("!/") + 2;
String jarPath = urlAsString.substring(pathStart);
jarEntry = warFile.getJarEntry(jarPath);
-
- jarInputStream = createJarInputStream();
}
@@ -61,6 +59,7 @@ public class FileUrlNestedJar implements
@Override
public boolean entryExists(String name) throws IOException {
+ reset();
JarEntry entry = jarInputStream.getNextJarEntry();
while (entry != null) {
if (name.equals(entry.getName())) {
@@ -75,6 +74,7 @@ public class FileUrlNestedJar implements
@Override
public InputStream getInputStream(String name) throws IOException {
+ reset();
JarEntry entry = jarInputStream.getNextJarEntry();
while (entry != null) {
if (name.equals(entry.getName())) {
@@ -148,6 +148,14 @@ public class FileUrlNestedJar implements
@Override
public void nextEntry() {
+ if (jarInputStream == null) {
+ try {
+ jarInputStream = createJarInputStream();
+ } catch (IOException e) {
+ entry = null;
+ return;
+ }
+ }
try {
entry = jarInputStream.getNextJarEntry();
} catch (IOException ioe) {
@@ -168,6 +176,9 @@ public class FileUrlNestedJar implements
@Override
public InputStream getEntryInputStream() throws IOException {
+ if (jarInputStream == null) {
+ createJarInputStream();
+ }
return jarInputStream;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]