[OpenJDK 2D-Dev] 5106550: PNG writer merge standard metadata fails for TextEntry sans #IMPLIED attributes
Andrew.Brygin at Sun.COM
Fri Dec 12 07:26:22 PST 2008
As you probably saw your fix for 5106550 was just pushed into 2d
There is short status for other two your suggested fixes:
- 5082756: finished engineering review, waiting for CCC decision.
- 6541476: as we had commited fix for this bug id I'd submitted new
bug report (6782079)
for this problem. Fix is being reviewed now.
Both these suggested fixes were tweaked during engineering review.
I'll send you updated webrevs separately as they seems to be a bit too
large to send everyone on this list : ) (about 1Mb).
Martin von Gagern wrote:
> Bug ID: 5106550; State: 3-Accepted, bug; Priority: 4-Low
> The bug lies in the fact that for TextEntry nodes in standard metadata
> format, PNGMetadata requires additional attributes besides the ones
> marked #REQUIRED in the DTD. Namely missing encoding, language or
> compression will result in an IIOInvalidTreeException:
>> Exception in thread "main" javax.imageio.metadata.IIOInvalidTreeException: Required attribute encoding not present!
>> at com.sun.imageio.plugins.png.PNGMetadata.fatal(PNGMetadata.java:1085)
>> at com.sun.imageio.plugins.png.PNGMetadata.getAttribute(PNGMetadata.java:1208)
>> at com.sun.imageio.plugins.png.PNGMetadata.getAttribute(PNGMetadata.java:1217)
>> at com.sun.imageio.plugins.png.PNGMetadata.mergeStandardTree(PNGMetadata.java:1921)
>> at com.sun.imageio.plugins.png.PNGMetadata.mergeTree(PNGMetadata.java:1232)
>> at MergeStdCommentTest.main(MergeStdCommentTest.java:37)
> The patch fixes this by
> 1. not reading the "encoding" attribute at all,
> as it isn't even used in the following code
> 2. having the "language" attribute default to "",
> as http://www.w3.org/TR/PNG/#11iTXt states that
> "if the language tag is empty, the language is unspecified"
> 3. having the "compression" attribute default to "none",
> as this is the default given in the DTD
> 4. ignore any node with missing or empty "keyword",
> as the PNG standard requires a keyword of length at least 1
> according to http://www.w3.org/TR/PNG/#11tEXt
> I changed invocations from the previously used
> private String getAttribute(Node node, String name)
> which implied a required argument to the more flexible
> private String getStringAttribute(Node node,
> String name,
> String defaultValue,
> boolean required)
> Open question:
> Do you agree in dropping nodes with missing keywords?
> This follows the concept of not merging parts of the standard metadata
> model which have no counterpart in a specific file format, but might
> still lead to unexpected behaviour.
> I previously had this fix submitted to jdk7-dev, and mentioned in a
> posting "Bug fixes for com.sun.imageio.plugins.png.PNGMetadata" here.
> In the meantime, I have had a look at the mq extension of mercurial.
> Thus the attached patch is now a single patch straight out of my patch
> queue. I submit it here, waiting for comments, discussion, sponsorship.
> Once you consider it ready for inclusion, I can commit it localy and
> post a patch exported by hg.
> Martin von Gagern
More information about the 2d-dev