You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2010/10/08 14:01:33 UTC

[jira] Commented: (HARMONY-6669) [classlib][archive] java.util.jar.InitManifest throws IndexOutOfBoundException when reading special Manifest file

    [ https://issues.apache.org/jira/browse/HARMONY-6669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919250#action_12919250 ] 

Tim Ellison commented on HARMONY-6669:
--------------------------------------

Hi Jonathan.  Thanks for the issue.  I agree it should parse the manifest correctly here, but I disagree with the proposed patch.  it is masking incorrect values being passed in, and it seems that the correct fix is to ensure readValue() sets the mark and position correctly.


> [classlib][archive] java.util.jar.InitManifest throws IndexOutOfBoundException when reading special Manifest file
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6669
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6669
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: WinXP SP3 x86
>            Reporter: Jonathan Lu
>            Assignee: Tim Ellison
>         Attachments: InitManifest.patch, MANIFEST.MF
>
>
> java.util.jar.InitManifest throws IndexOutOfBoundException when reading special Manifest file while RI will work fine.
> This bug can be recreated with the following simple test case and the attached MANIFEST.MF which is created based on the manifest file from   archive.jar of Harmony.
>         File file = new File("MANIFEST.MF");
>         try {
>             FileInputStream fis = new FileInputStream(file);
>             Manifest manifest = new Manifest(fis);
> The root cause is one space character (' ') occurs in front of the line break characters (\r,\n) at the last line of the manifest file. 
> Full stack trace:
> java.lang.IndexOutOfBoundsException
> 	at java.nio.ByteBuffer.wrap(ByteBuffer.java:106)
> 	at java.util.jar.InitManifest.decode(InitManifest.java:214)
> 	at java.util.jar.InitManifest.readValue(InitManifest.java:171)
> 	at java.util.jar.InitManifest.readHeader(InitManifest.java:117)
> 	at java.util.jar.InitManifest.<init>(InitManifest.java:55)
> 	at java.util.jar.Manifest.read(Manifest.java:231)
> 	at java.util.jar.Manifest.<init>(Manifest.java:95)
> 	at InitManifestTest.test_StandAloneManifest(InitManifestTest.java:23)
> 	at java.lang.reflect.Method.invokeImpl(Native Method)
> 	at java.lang.reflect.Method.invoke(Method.java:228)
> 	at junit.framework.TestCase.runTest(TestCase.java:168)
> 	at junit.framework.TestCase.runBare(TestCase.java:134)
> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
> 	at junit.framework.TestResult.run(TestResult.java:113)
> 	at junit.framework.TestCase.run(TestCase.java:124)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:232)
> 	at junit.framework.TestSuite.run(TestSuite.java:227)
> 	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.