harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r1021745 - in /harmony/enhanced/java/trunk/classlib/modules/archive/src: main/java/java/util/jar/InitManifest.java test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java
Date Tue, 12 Oct 2010 11:29:38 GMT
Author: tellison
Date: Tue Oct 12 11:29:38 2010
New Revision: 1021745

URL: http://svn.apache.org/viewvc?rev=1021745&view=rev
Log:
Fix for HARMONY-6669 ([classlib][archive] java.util.jar.InitManifest throws IndexOutOfBoundException
when reading special Manifest file)

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

Modified: harmony/enhanced/java/trunk/classlib/modules/archive/src/main/java/java/util/jar/InitManifest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/archive/src/main/java/java/util/jar/InitManifest.java?rev=1021745&r1=1021744&r2=1021745&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/archive/src/main/java/java/util/jar/InitManifest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/archive/src/main/java/java/util/jar/InitManifest.java
Tue Oct 12 11:29:38 2010
@@ -186,6 +186,7 @@ class InitManifest {
                 if (linebreak == 1) {
                     decode(mark, last, false);
                     mark = pos;
+                    last = mark;
                     linebreak = 0;
                     continue;
                 }

Modified: harmony/enhanced/java/trunk/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java?rev=1021745&r1=1021744&r2=1021745&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/archive/src/test/java/org/apache/harmony/archive/tests/java/util/jar/ManifestTest.java
Tue Oct 12 11:29:38 2010
@@ -46,6 +46,8 @@ public class ManifestTest extends TestCa
     private static final String MANIFEST_CONTENTS = "Manifest-Version: 1.0\nBundle-Name:
ClientSupport\nBundle-Description: Provides SessionService, AuthenticationService. Extends
RegistryService.\nBundle-Activator: com.ibm.ive.eccomm.client.support.ClientSupportActivator\nImport-Package:
com.ibm.ive.eccomm.client.services.log,\n com.ibm.ive.eccomm.client.services.registry,\n com.ibm.ive.eccomm.service.registry;
specification-version=1.0.0,\n com.ibm.ive.eccomm.service.session; specification-version=1.0.0,\n
com.ibm.ive.eccomm.service.framework; specification-version=1.2.0,\n org.osgi.framework; specification-version=1.0.0,\n
org.osgi.service.log; specification-version=1.0.0,\n com.ibm.ive.eccomm.flash; specification-version=1.2.0,\n
com.ibm.ive.eccomm.client.xml,\n com.ibm.ive.eccomm.client.http.common,\n com.ibm.ive.eccomm.client.http.client\nImport-Service:
org.osgi.service.log.LogReaderService\n org.osgi.service.log.LogService,\n com.ibm.ive.eccomm.service.registry.Regis
 tryService\nExport-Package: com.ibm.ive.eccomm.client.services.authentication; specification-version=1.0.0,\n
com.ibm.ive.eccomm.service.authentication; specification-version=1.0.0,\n com.ibm.ive.eccomm.common;
specification-version=1.0.0,\n com.ibm.ive.eccomm.client.services.registry.store; specification-version=1.0.0\nExport-Service:
com.ibm.ive.eccomm.service.authentication.AuthenticationService,\n com.ibm.ive.eccomm.service.session.SessionService\nBundle-Vendor:
IBM\nBundle-Version: 1.2.0\n";
     
     private static final String MANIFEST_CONTENTS_1 = "Manifest-Version: 2.0\nBundle-Name:
ClientSupport\nBundle-Description: Provides SessionService, AuthenticationService. Extends
RegistryService.\nBundle-Activator: com.ibm.ive.eccomm.client.support.ClientSupportActivator\nImport-Package:
com.ibm.ive.eccomm.client.services.log,\n com.ibm.ive.eccomm.client.services.registry,\n com.ibm.ive.eccomm.service.registry;
specification-version=2.0.0,\n com.ibm.ive.eccomm.service.session; specification-version=2.0.0,\n
com.ibm.ive.eccomm.service.framework; specification-version=2.1.0,\n org.osgi.framework; specification-version=2.0.0,\n
org.osgi.service.log; specification-version=2.0.0,\n com.ibm.ive.eccomm.flash; specification-version=2.2.0,\n
com.ibm.ive.eccomm.client.xml,\n com.ibm.ive.eccomm.client.http.common,\n com.ibm.ive.eccomm.client.http.client\nImport-Service:
org.osgi.service.log.LogReaderService\n org.osgi.service.log.LogService,\n com.ibm.ive.eccomm.service.registry.Reg
 istryService\nExport-Package: com.ibm.ive.eccomm.client.services.authentication; specification-version=1.0.0,\n
com.ibm.ive.eccomm.service.authentication; specification-version=1.0.0,\n com.ibm.ive.eccomm.common;
specification-version=1.0.0,\n com.ibm.ive.eccomm.client.services.registry.store; specification-version=1.0.0\nExport-Service:
com.ibm.ive.eccomm.service.authentication.AuthenticationService,\n com.ibm.ive.eccomm.service.session.SessionService\nBundle-Vendor:
IBM\nBundle-Version: 1.2.0\n";
+    
+    private static final String MANIFEST_CONTENTS_2 = "Manifest-Version: 1.0\nName: value\n
\n"; // Note penultimate line is single space
 
     private File resources;
 
@@ -153,6 +155,10 @@ public class ManifestTest extends TestCa
         Attributes namedEntryAttributes = (Attributes) (entries.get(""));
         assertEquals("Should be 6 named entry attributes", 6,
                 namedEntryAttributes.size());
+        
+        // Regression test for HARMONY-6669
+        new Manifest(new ByteArrayInputStream(
+            MANIFEST_CONTENTS_2.getBytes("ISO-8859-1")));
     }
 
     /**



Mime
View raw message