Serialize methods fail to close locally created XMLStreamWriters
----------------------------------------------------------------
Key: WSCOMMONS-222
URL: https://issues.apache.org/jira/browse/WSCOMMONS-222
Project: WS-Commons
Issue Type: Bug
Components: AXIOM
Reporter: Rich Scheuerle
Assignee: Rich Scheuerle
Example from NodeImpl.java:
Here is the current code:
public void serialize(OutputStream output) throws XMLStreamException {
serialize(StAXUtils.createXMLStreamWriter(output));
}
Here is the suggested change that correctly closes the locally created
XMLStreamWriter:
public void serialize(OutputStream output) throws XMLStreamException {
XMLStreamWriter xmlStreamWriter =
StAXUtils.createXMLStreamWriter(output);
try {
serialize(xmlStreamWriter);
} finally {
xmlStreamWriter.close();
}
}
Failure to close the XMLStreamWriter prevents resources from being freed.
I scrubbed the Axiom code and corrected all of the occurrences of this pattern.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]