XMLEventStreamWriter fails to handle writeEmptyElement() followed by writeAttribute() [SPR-11254] #15879
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Archie Cobbs opened SPR-11254 and commented
XMLEventStreamWriter
converts anXMLStreamWriter
into anXMLEventWriter
.However, it fails to handle the following sequence of API calls:
What happens is you get this exception:
The problem is that the
XMLEventStreamWriter
implementation seems to think that "writeEmptyElement" means "write element with no attributes", whereas what it really means is "write element with no nested content" (i.e., an element that can be self-closing).The usage above is explicitly supported by the
XMLStreamWriter
API and in the JDK implementation results in a self-closing tag being emitted -- with or without attributes.The fix is to keep track of whether the most recent element is self-closing or not.
Affects: 3.2.6, 4.0 GA
Attachments:
Backported to: 3.2.7
The text was updated successfully, but these errors were encountered: