jettison-json/jettison

Jettison fails to setialize a list of beans if bean's name matches its attribute name

Opened this issue · 1 comments

Jettison fails to serialize a list of beans when bean's name matches one of its attributes' with the first letter capitalized, e.g. bean class TestItem with a field testItem.

Apparently, it fails serializing nested elements with the same name. The following structure:

item

produces:

javax.xml.stream.XMLStreamException: Too many closing tags.
at org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeEndElement(MappedXMLStreamWriter.java:246)
at org.apache.cxf.staxutils.DelegatingXMLStreamWriter.writeEndElement(DelegatingXMLStreamWriter.java:123)
at org.apache.cxf.jaxrs.provider.json.utils.JSONUtils$IgnoreContentJettisonWriter.writeEndElement(JSONUtils.java:255)

However, a single item:

item

is transformed into

{"testItem":{"testItem":"item"}}

normally.

Is this solved by #15?