Issue Details (XML | Word | Printable)

Key: JAXB-918
Type: Bug Bug
Status: In Progress In Progress
Priority: Major Major
Assignee: Iaroslav Savytskyi
Reporter: ratoo
Votes: 0
Watchers: 0

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

Wrong element name serialized.

Created: 05/Sep/12 02:50 PM   Updated: 16/Sep/13 03:47 PM
Component/s: runtime
Affects Version/s: 2.2.5
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive (16 kB) 16/Sep/13 03:47 PM - Martin Grebac


JDK6u35, JDK7u7 Win7 64

Participants: Iaroslav Savytskyi and ratoo

 Description  « Hide

There is a bug in com.sun.xml.bind.v2.runtime.output.NamespaceContextImpl

NamespaceContextImpl reuses NamespaceContextImpl.Element objects to generate prefixes.
NamespaceContextImpl.Element.setTagName(Name tagName, Object outerPeer) doesn't clean up NamespaceContextImpl.Element.elementLocalName
When the element is reused in
NamespaceContextImpl.declareNsUri(String uri, String preferedPrefix, boolean requirePrefix) {
if (current.elementLocalName!=null) { // CHANGES A NAME TO THOSE LEFT FROM AN OTHER NODE!!! current.setTagName(size, current.elementLocalName, current.getOuterPeer()); }

Solution is to clean elementLocalName in

public void setTagName( Name tagName, Object outerPeer ) { assert tagName!=null; this.elementName = tagName; this.elementLocalName = null; // + this.outerPeer = outerPeer; }