eclipse-ee4j / eclipse-ee4j/jaxb-fi

StAXDocumentSerializer.writeEndDocument() don't close elements correctly

Open
#47 3 comments 0 reactions 1 assignee Claimed by @glassfishrobot View on GitHub
Component: core Priority: Minor Type: Bug
Dominant language
Java
Stars
12
Forks
9
Avg merge
1d 15h
Merged PRs (30d)
3

Description

In StAXDocumentSerializer.writeEndDocument() there is a piece of code that try to close elements that are not closed :

for(;_stackCount >= 0; _stackCount--) {
writeEndElement();
}

This code is wrong because _stackCount is decremented twice : in the for block and in writeEndElement().
Also, it doesn't manage well a single writeEmptyElement("x") in the document.

A solution should be :

if (_isEmptyElement) encodeTerminationAndCurrentElement(true);
while (_stackCount >= 0) writeEndElement();
#### Affected Versions
[current]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.