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 2013/09/16 15:12:10 UTC
svn commit: r1523629 -
/tomcat/trunk/java/org/apache/catalina/webresources/JarWarResourceSet.java
Author: markt
Date: Mon Sep 16 13:12:10 2013
New Revision: 1523629
URL: http://svn.apache.org/r1523629
Log:
Correctly populate the entries list.
Modified:
tomcat/trunk/java/org/apache/catalina/webresources/JarWarResourceSet.java
Modified: tomcat/trunk/java/org/apache/catalina/webresources/JarWarResourceSet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/JarWarResourceSet.java?rev=1523629&r1=1523628&r2=1523629&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/webresources/JarWarResourceSet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/webresources/JarWarResourceSet.java Mon Sep 16 13:12:10 2013
@@ -21,12 +21,12 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.WebResource;
@@ -263,12 +263,18 @@ public class JarWarResourceSet extends A
@Override
protected void initInternal() throws LifecycleException {
- try (JarFile jarFile = new JarFile(getBase())) {
- Enumeration<JarEntry> entries = jarFile.entries();
- while (entries.hasMoreElements()) {
- JarEntry entry = entries.nextElement();
- jarFileEntries.put(entry.getName(), entry);
+ try (JarFile warFile = new JarFile(getBase())) {
+ JarEntry jarFileInWar = warFile.getJarEntry(archivePath);
+ InputStream jarFileIs = warFile.getInputStream(jarFileInWar);
+
+ try (JarInputStream jarIs = new JarInputStream(jarFileIs)) {
+ JarEntry entry = jarIs.getNextJarEntry();
+ while (entry != null) {
+ jarFileEntries.put(entry.getName(), entry);
+ entry = jarIs.getNextJarEntry();
+ }
}
+
} catch (IOException ioe) {
throw new IllegalArgumentException(ioe);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org