You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Rich Scheuerle (JIRA)" <ji...@apache.org> on 2007/07/18 23:13:04 UTC

[jira] Commented: (WSCOMMONS-222) Serialize methods fail to close locally created XMLStreamWriters

    [ https://issues.apache.org/jira/browse/WSCOMMONS-222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513719 ] 

Rich Scheuerle commented on WSCOMMONS-222:
------------------------------------------

I will provide a fix later this week.  This fix is not required for the 1.2.5 version of Axiom.


> 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: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org