tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1742187 - /tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java
Date Tue, 03 May 2016 19:54:39 GMT
Author: markt
Date: Tue May  3 19:54:38 2016
New Revision: 1742187

URL: http://svn.apache.org/viewvc?rev=1742187&view=rev
Log:
Avoid NPEs

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java?rev=1742187&r1=1742186&r2=1742187&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/UrlJar.java Tue May  3 19:54:38 2016
@@ -124,6 +124,14 @@ public class UrlJar implements Jar {
 
     @Override
     public void nextEntry() {
+        if (jarInputStream == null) {
+            try {
+                jarInputStream = createJarInputStream();
+            } catch (IOException e) {
+                entry = null;
+                return;
+            }
+        }
         try {
             entry = jarInputStream.getNextJarEntry();
         } catch (IOException ioe) {
@@ -131,6 +139,7 @@ public class UrlJar implements Jar {
         }
     }
 
+
     @Override
     public String getEntryName() {
         if (entry == null) {
@@ -140,11 +149,16 @@ public class UrlJar implements Jar {
         }
     }
 
+
     @Override
     public InputStream getEntryInputStream() throws IOException {
+        if (jarInputStream == null) {
+            jarInputStream = createJarInputStream();
+        }
         return jarInputStream;
     }
 
+
     @Override
     public void reset() throws IOException {
         close();



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message