You are viewing a plain text version of this content. The canonical link for it is here.
Posted to savan-dev@ws.apache.org by "Andreas Veithen (JIRA)" <ji...@apache.org> on 2010/05/26 20:02:36 UTC

[jira] Resolved: (AXIS2-4726) Partial Base64Binary data when underlying XML parser does not coalesce text

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

Andreas Veithen resolved AXIS2-4726.
------------------------------------

    Fix Version/s: 1.6
       Resolution: Fixed

The way ADB handles MTOM and base64 has been completely revised and this issue should no longer occur with the current trunk.

> Partial Base64Binary data when underlying XML parser does not coalesce text
> ---------------------------------------------------------------------------
>
>                 Key: AXIS2-4726
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4726
>             Project: Axis2
>          Issue Type: Bug
>    Affects Versions: 1.5.1
>            Reporter: Myles Bunbury
>             Fix For: 1.6
>
>
> After running wsdl2java.sh, the following code snippet was produced for Base64Binary.parse(XMLStreamReader):
> ---
>                                     if (isReaderMTOMAware(reader)
>                                             &&
>                                             java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY)))
>                                     {
>                                         //MTOM aware reader - get the datahandler directly and put it in the object
>                                         object.setBase64Binary(
>                                                 (javax.activation.DataHandler) reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER));
>                                     } else {
>                                         if (reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT && reader.getName().equals(new javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI, org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE)))
>                                         {
>                                             java.lang.String id = org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8");
>                                             object.setBase64Binary(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder) ((org.apache.axiom.om.impl.llom.OMStAXWrapper) reader).getBuilder()).getDataHandler(id));
>                                             reader.next();
>                                             
>                                         } else if(reader.hasText()) {
>                                             //Do the usual conversion
>                                             java.lang.String content = reader.getText();
> //Bug is below
>                                             object.setBase64Binary(
>                                                     org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content));
>                                             
>                                         }
>                                     }
> ---
> In the last 'else if' block, 'object.setBase64Binary' is called. However, if the XMLStreamReader is not coalescing, then multiple text nodes can be encountered as this block of code is looped through via the encapsulating while loop (not shown). With each pass through the loop, old data is overwritten. The entire text needs to be collected first before calling convertToBase64Binary().
> The other branches of the conditional statements are likely vulnerable to the same problem.

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