Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ public void close(@Nullable StaxWriterCallback footerCallback, List<QName> unclo
footerCallback.write(footerCallbackWriter);
}
delegateEventWriter.flush();
endDocument();
endDocument(delegateEventWriter);
}
catch (IOException e) {
throw new ItemStreamException("Failed to write footer items", e);
Expand Down Expand Up @@ -893,7 +893,7 @@ private void closeStream() {
* @throws XMLStreamException thrown if error occurs.
*/
@SuppressWarnings("DataFlowIssue")
private void endDocument() throws XMLStreamException {
private void writeEndRootElement() throws XMLStreamException {

// writer.writeEndDocument(); <- this doesn't work after restart
// we need to write end tag of the root element manually
Expand Down Expand Up @@ -925,4 +925,14 @@ private void setPosition(long newPosition) {

}

/**
* Writes the EndDocument tag manually.
* @param writer XML event writer
* @throws XMLStreamException thrown if error occurs.
*/
protected void endDocument(XMLEventWriter writer) throws XMLStreamException {
Assert.state(this.state != null, "OutputState is not initialized");
this.state.writeEndRootElement();
}

}