[JAXP-67] StAXEvent2SAX.handleEndElement() iterates over Namespaces as Strings Created: 27/Aug/10  Updated: 27/Aug/10

Status: Open
Project: jaxp
Component/s: www
Affects Version/s: current
Fix Version/s: milestone 1

Type: Bug Priority: Major
Reporter: poutsma Assignee: jaxp-issues
Resolution: Unresolved Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: Macintosh


Issuezilla Id: 67

 Description   

In StAXEvent2SAX.handleEndElement(), line 357, an iterator is created that iterates over the namespaces of the Stax EndElement. The namespaces are
casted to Strings, while the javadoc for EndElement clearly states that the returned iterator iterates over javax.xml.stream.events.Namespace objects. See
http://download.oracle.com/javase/6/docs/api/javax/xml/stream/events/EndElement.html#getNamespaces()

Needless to say, this results in ClassCastExceptions, for instance when used with the Woodstox Stax implementation, version 3.2.9.



 Comments   
Comment by poutsma [ 27/Aug/10 ]

Here is a little code snippet that reproduces this bug:

String xml = "<root xmlns='http://springframework.org'><child>Foo</child></root>";
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(xml));

Transformer transformer = TransformerFactory.newInstance().newTransformer();

transformer.transform(new StAXSource(eventReader), new StreamResult(System.out));

Comment by poutsma [ 27/Aug/10 ]

This bug also occurs with the Stax RI.

Generated at Fri Mar 06 07:09:13 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.