harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r615189 - in /harmony/enhanced/classlib/trunk/modules/archive/src: main/java/java/util/jar/InitManifest.java test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java
Date Fri, 25 Jan 2008 11:51:38 GMT
Author: tellison
Date: Fri Jan 25 03:51:34 2008
New Revision: 615189

URL: http://svn.apache.org/viewvc?rev=615189&view=rev
Log:
Fix for HARMONY-5426 (Harmony fails to parse manifest named entries with blank names)

Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
    harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java?rev=615189&r1=615188&r2=615189&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/jar/InitManifest.java
Fri Jan 25 03:51:34 2008
@@ -85,7 +85,7 @@
             }
             it = list.iterator();
             String line = it.next();
-            if (line.length() < 7
+            if (line.length() < 6
                     || !Util.toASCIILowerCase(line.substring(0, 5)).equals(
                             "name:")) { //$NON-NLS-1$
                 throw new IOException(Messages.getString("archive.23")); //$NON-NLS-1$

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java?rev=615189&r1=615188&r2=615189&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java
Fri Jan 25 03:51:34 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.harmony.archive.tests.java.util.jar;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -85,7 +86,7 @@
 	/**
 	 * @tests java.util.jar.Manifest#Manifest(java.io.InputStream)
 	 */
-	public void test_ConstructorLjava_io_InputStream() {
+	public void test_ConstructorLjava_io_InputStream() throws IOException {
 		// Test for method java.util.jar.Manifest(java.io.InputStream)
 		/*
 		 * ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -138,6 +139,23 @@
 				);
 		assertEquals("Bundle-Version not correct", "1.2.0", main
 				.getValue("Bundle-Version"));
+
+        // Regression test for HARMONY-5424
+        String manifestContent = "Manifest-Version: 1.0\nCreated-By: Apache\nPackage: \nBuild-Jdk:
1.4.1_01\n\n"
+                + "Name: \nSpecification-Title: foo\nSpecification-Version: 1.0\nSpecification-Vendor:
\n"
+                + "Implementation-Title: \nImplementation-Version: 1.0\nImplementation-Vendor:
\n\n";
+        ByteArrayInputStream bis = new ByteArrayInputStream(manifestContent
+                .getBytes());
+        Manifest mf = new Manifest(bis);
+
+        assertTrue("Wrong number of main attributes", mf.getMainAttributes().size() == 4);
+
+        Map<String, Attributes> entries = mf.getEntries();
+        assertTrue("Wrong number of named entries", entries.size() == 1);
+
+        Attributes namedEntryAttributes = (Attributes) (entries.get(""));
+        assertTrue("Wrong number of named entry attributes",
+                namedEntryAttributes.size() == 6);
 	}
 
 	/**



Mime
View raw message