JDK-5094154 : JPGStreamMetadata obtained from writer throws NPE when calling mergeTree()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2004-08-30
  • Updated: 2014-03-18
Related Reports
Relates :  
Relates :  
Relates :  
Description
I am getting the IIOMetadata object from the JPEG Writer by calling writer.getStreamMetadata(writeParam). This metadata claims to support Native as well as standard metadata formats. I am getting the Node object from this metadata by calling getAsTree(native format name) and trying to merge this node with the same metadata tree. The following exception is thrown by mergeTree():

java.lang.NullPointerException
at com.sun.imageio.plugins.jpeg.MarkerSegment.getAttributeValue(MarkerSegment.java:131)
at com.sun.imageio.plugins.jpeg.JFIFMarkerSegment.updateFromNativeNode(JFIFMarkerSegment.java:240)
at com.sun.imageio.plugins.jpeg.JFIFMarkerSegment.<init>(JFIFMarkerSegment.java:133)
at com.sun.imageio.plugins.jpeg.JPEGMetadata.mergeJFIFsubtree(JPEGMetadata.java:1113)
at com.sun.imageio.plugins.jpeg.JPEGMetadata.mergeNativeTree(JPEGMetadata.java:1091)
at com.sun.imageio.plugins.jpeg.JPEGMetadata.mergeTree(JPEGMetadata.java:1061)
at WriterStreamMetadataTest.<init>(WriterStreamMetadataTest.java:68)
at WriterStreamMetadataTest.main(WriterStreamMetadataTest.java:134)

This is reproducible on all platforms since JDK1.4.

I have attached a sample test. Execute it as follows:

java WriterStreamMetadataTest <format> [merge]

If 'merge' is specified, you would see the above exception for JPEG format. If 'merge' is not specified, the test would still fail reproducing a different bug: 4894894

Comments
Please re-open if - if fix is in progress or on the plan to fix soon - if this is a P3 (file as P3, not P4)
18-03-2014

EVALUATION Not a stopper. ###@###.### 2004-09-16
16-09-2004