harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Lu (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-6669) [classlib][archive] java.util.jar.InitManifest throws IndexOutOfBoundException when reading special Manifest file
Date Fri, 08 Oct 2010 05:59:31 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-6669?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jonathan Lu updated HARMONY-6669:
---------------------------------

    Description: 
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)



  was:
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 Harmony's archive.jar/MANIFEST.MF.
        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)



        Summary: [classlib][archive] java.util.jar.InitManifest throws IndexOutOfBoundException
when reading special Manifest file  (was: java.util.jar.InitManifest throws IndexOutOfBoundException
when reading special Manifest file)

> [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
>         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.


Mime
View raw message