[
https://issues.apache.org/jira/browse/AXIS2-4726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12871844#action_12871844
]
Myles Bunbury commented on AXIS2-4726:
--------------------------------------
Make that Base64Binary.Factory.parse(XMLStreamReader).
> 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
>
> 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: [email protected]
For additional commands, e-mail: [email protected]