[ 
https://issues.apache.org/jira/browse/WSCOMMONS-368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on WSCOMMONS-368 started by Rich Scheuerle.

> OMNodeImpl serialize methods are causing excessive wrappering of 
> MTOMXMLStreamWriter objects
> --------------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-368
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-368
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Rich Scheuerle
>            Assignee: Rich Scheuerle
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Problem:
> There are several serialize methods in the llom and dom implementations that 
> cause excessive wrappering of MTOMXMLStreamWriter objects.  This increases 
> call path and temporary objects.  (Plus it can cause problems because the 
> inner MTOMXMLStreamWriter may have special OMFormat settings that are masked 
> by the outer MTOMXMLStreamWriter).
> Example  Current, Bad Code:
> /**
>      * Serializes the node with caching.
>      *
>      * @param xmlWriter
>      * @throws javax.xml.stream.XMLStreamException
>      *
>      */
>     public void serialize(XMLStreamWriter xmlWriter) throws 
> XMLStreamException {
>         
>        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(xmlWriter);
>         internalSerialize(writer);
>         writer.flush();
>     }
> Corrected Code:
> /**
>      * Serializes the node with caching.
>      *
>      * @param xmlWriter
>      * @throws javax.xml.stream.XMLStreamException
>      *
>      */
>     public void serialize(XMLStreamWriter xmlWriter) throws 
> XMLStreamException {
>         
>         // If the input xmlWriter is not an MTOMXMLStreamWriter, then wrapper 
> it
>         MTOMXMLStreamWriter writer = xmlWriter instanceof MTOMXMLStreamWriter 
> ?
>                 (MTOMXMLStreamWriter) xmlWriter : 
>                     new MTOMXMLStreamWriter(xmlWriter);
>         internalSerialize(writer);
>         writer.flush();
>     }
> Next Step:
> I am making this change in 4 places in Axiom.  I will commit the change after 
> I complete Axiom and Axis2 testing.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to