Issue Details (XML | Word | Printable)

Key: HARMONY-6121
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Tim Ellison
Reporter: Tim Ellison
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Harmony

[classlib][archive] org.apache.harmony.archive.tests.java.util.jar.ManifestTest fails

Created: 18/Mar/09 12:35 PM   Updated: 25/Mar/09 11:22 AM
Return to search
Component/s: Classlib
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works hy-6121-version2.patch 2009-03-18 03:44 PM Tim Ellison 4 kB
Text File Licensed for inclusion in ASF works hy-6121.patch 2009-03-18 12:35 PM Tim Ellison 4 kB
Environment: reported on Win XP during M9 testing

Resolution Date: 25/Mar/09 09:09 AM


 Description  « Hide
java.lang.NullPointerException
at java.io.InputStream.read(InputStream.java:148)
at java.io.InputStream.read(InputStream.java:121)
at org.apache.harmony.luni.util.InputStreamExposer.expose(InputStreamExposer.java:118)
at java.util.jar.Manifest.read(Manifest.java:208)
at org.apache.harmony.archive.tests.java.util.jar.ManifestTest.testRead(ManifestTest.java:420)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Tim Ellison added a comment - 18/Mar/09 12:35 PM
Proposed patch for review.

Nathan Beyer added a comment - 18/Mar/09 03:18 PM
Hmm the previous code is a little odd. This looks much better. +1

Tim Ellison added a comment - 18/Mar/09 03:44 PM
New patch (version 2) with more robust line detection.

Alexei Fedotov added a comment - 25/Mar/09 06:20 AM
I have a strong feeling that I have already implemented readFully() method for reading ("wrapping") manifests in HARMONY-4569. The stream was examined to be an instance of ByteArrayStream, and for those streams a fast reflection path worked. Otherwise the stream was read using slower methods.

[1] https://issues.apache.org/jira/secure/attachment/12378468/ByteBuffer.java

Tim Ellison added a comment - 25/Mar/09 09:09 AM
Yes, and that fast reflection path is still there in the InputStreamExposer. I modified it to throw an UnsupportedOperationException when the reflection 'trick' does not work rather than trying to read the entire stream, since the regression testcase passes in a stream that always returns a byte (an "infinite" stream).

The original code caught OutOfMemoryException and converted it to an IO exception, but that did not work on some machines. The new implementation, if it cannot use the fast reflection path, reads a chunk and looks for a CR/CR LF within a reasonable length of data, and throws the IO exception if it does not see one.

Tim Ellison added a comment - 25/Mar/09 09:10 AM
Fixed in ARCHIVE and LUNI modules are r757150.

Alexei Fedotov added a comment - 25/Mar/09 11:22 AM
Tim, thanks for explaining! I was just checking svn annotate to understand what happened. I understand and support you fix.