[jboss-cvs] JBossAS SVN: r68561 - projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 26 12:11:26 EST 2007


Author: alesj
Date: 2007-12-26 12:11:26 -0500 (Wed, 26 Dec 2007)
New Revision: 68561

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java
Log:
NPE on empty contents.

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java	2007-12-26 16:27:48 UTC (rev 68560)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java	2007-12-26 17:11:26 UTC (rev 68561)
@@ -72,18 +72,20 @@
       this.entryURL = entryURL;
       this.isJar = JarUtils.isArchive(getName());
       int size = (int) entry.getSize();
-      if (size <= 0)
-         return;
-
-      ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
-      byte[] tmp = new byte[1024];
-      while (zis.available() > 0)
+      if (size > 0)
       {
-         int length = zis.read(tmp);
-         if (length > 0)
-            baos.write(tmp, 0, length);
+         ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
+         byte[] tmp = new byte[1024];
+         while (zis.available() > 0)
+         {
+            int length = zis.read(tmp);
+            if (length > 0)
+               baos.write(tmp, 0, length);
+         }
+         contents = baos.toByteArray();
       }
-      contents = baos.toByteArray();
+      else
+         contents = new byte[0];
    }
 
    /**




More information about the jboss-cvs-commits mailing list