harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r414730 - in /incubator/harmony/enhanced/classlib/trunk/modules/archive/src: main/java/java/util/jar/JarFile.java main/java/java/util/zip/ZipFile.java test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
Date Fri, 16 Jun 2006 04:08:38 GMT
Author: ndbeyer
Date: Thu Jun 15 21:08:37 2006
New Revision: 414730

URL: http://svn.apache.org/viewvc?rev=414730&view=rev
Log:
Apply patches for HARMONY-605.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
    incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java?rev=414730&r1=414729&r2=414730&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/JarFile.java
Thu Jun 15 21:08:37 2006
@@ -255,7 +255,7 @@
         if (manifest != null) {
             return manifest;
         }
-        if (manifestEntry != null) {
+		try {
             ByteArrayInputStream is = (ByteArrayInputStream) super
                     .getInputStream(manifestEntry);
             if (verifier != null) {
@@ -270,8 +270,10 @@
             } finally {
                 is.close();
             }
-            manifestEntry = null;
-        }
+	        manifestEntry = null;
+		} catch(NullPointerException e) {
+			manifestEntry = null;
+		}
         return manifest;
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java?rev=414730&r1=414729&r2=414730&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
Thu Jun 15 21:08:37 2006
@@ -177,6 +177,10 @@
 	 * @return an input stream on the ZipEntry data
 	 */
 	public InputStream getInputStream(ZipEntry entry) throws IOException {
+		if(descriptor == -1) {
+			/* the descriptor is set to -1 by native code to indicate the zip was closed */
+			throw new IllegalStateException();
+		}
 		byte[] buf = inflateEntryImpl2(descriptor, entry.getName());
 		if (buf == null) return null;
 		return new ByteArrayInputStream(buf);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java?rev=414730&r1=414729&r2=414730&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
Thu Jun 15 21:08:37 2006
@@ -291,6 +291,17 @@
 		} catch (IOException e) {
 			fail("IOException 3");
 		}
+		try {
+			Support_Resources.copyFile(resources, null, jarName2);
+			JarFile jF = new JarFile(new File(resources, jarName2));
+			jF.close();
+			jF.getManifest();
+		        fail("FAILED: expected IllegalStateException" ); 
+		} catch (IllegalStateException ise) {
+			//expected;
+		} catch (Exception e) {
+			fail("Exception during 4th test: " + e.toString());
+		}
 	}
 
 	/**



Mime
View raw message