Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6559064
Votes 1
Synopsis javax.imageio.metadata.IIOMetaDataNode needs to declare its behaviour for DOM L3 methods.
Category java:imageio
Reported Against
Release Fixed 7(b20), 6-open(b02) (Bug ID:2152968)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6584004
Submit Date 17-MAY-2007
Description
Image I/O describes image metadata in XML syntax using the W3C DOM,
and implements DOM specified interfaces in the org.w3c.dom package
In JDK 1.5 the internal use only XML "crimson" parser was replaced with "xerces"
and the DOM specification was updated from L2 to L3.

There were two consequences of this.

1) the DOM L3 specification added new methods as follows :
******
Node:
 short      compareDocumentPosition(Node other)
 String     getBaseURI()
 Object     getFeature(String feature, String version)
 String     getTextContent()
 Object     getUserData(String key)
 boolean    isDefaultNamespace(String namespaceURI)
 boolean    isEqualNode(Node arg)
 boolean    isSameNode(Node other)
 String     lookupNamespaceURI(String prefix)
 String     lookupPrefix(String namespaceURI)
 void       setTextContent(String textContent)
 Object     setUserData(String key, Object data, UserDataHandler handler)

Element extends Node
TypeInfo     getSchemaTypeInfo()
 void        setIdAttribute(String name, boolean isId)
 void        setIdAttributeNode(Attr idAttr, boolean isId)
 void        setIdAttributeNS(String namespaceURI, String localName, boolean isId)

Attr extends Node

 boolean     isId()
 TypeInfo     getSchemaTypeInfo()
******

Unfortunately these are java interfaces, and so the engineer who worked
on updating the org.w3c.dom package needed to implement these methods
in javax.imageio. The short cut taken was to have them throw a
DOMException indicating they are not implemented.

Since Image I/O doesn't need any of these new methods this is
arguably OK. But no javadoc was added so these methods inherit
their specification which gives no indication of this and also
has confusing comments to "see the table above" when there is
no table in the doc for IIOMetaDataNode.

At the very least we should add javadoc to all these methods
indicating their actual behaviour.

Note that "Attr" is a return type from some methods on IIOMetaDataNode,
so it also needs to be mentioned that these return values will also
throw DOMException.

2. The second consequence, is that in setAttribute(name, value)
to verify that the name of an attribute was legal, Image I/O
needed to call in to Crimson. When Crimson was replaced, the
engineer doing this chose to copy the two Crimson classes
used into Image I/O rather than examining what was a
more appropriate solution.

The 1.4 DOM L2 javadoc had stated :
   * @exception DOMException
     *   INVALID_CHARACTER_ERR: Raised if the specified name contains an
     *   illegal character. 

However for L3 ( JDK 1.5) this was refined to :
DOMException - INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute. 

But Document.getXmlVersion() states in part :
If there is no declaration and if this document supports the "XML" feature, the value is "1.0". If this document does not support the "XML" feature, the value is always null. Changing this attribute will affect methods that check for invalid characters in XML names. 

But IOMetaDataNode.getDocumentOwner() states :
Returns null, since IIOMetadataNodes do not belong to any Document. 

Therefore, so as long as a character is a legal unicode character,
it should be permissible as a name of IIOMetaDataNode attribute,
and we do not need the crimson code to determine this.
Posted Date : 2007-05-17 22:11:05.0
Work Around
N/A
Evaluation
Need to :
1. Document the actual behaviour of the L3 Methods.

2. Remove the dependency on crimson
Posted Date : 2007-05-17 22:11:05.0
Comments
  
  Include a link with my name & email   

Submitted On 28-JUN-2007
dehionanosa
I want to use xpath



PLEASE NOTE: JDK6 is formerly known as Project Mustang