axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Myles Bunbury (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-4726) Partial Base64Binary data when underlying XML parser does not coalesce text
Date Wed, 26 May 2010 17:32:41 GMT

    [ https://issues.apache.org/jira/browse/AXIS2-4726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12871838#action_12871838
] 

Myles Bunbury commented on AXIS2-4726:
--------------------------------------

The following is a snippet from the WSDL's schema that produced the offending code:

---

      <xsd:simpleType name="GenericDataType">
        <xsd:restriction base="xsd:string">
          <xsd:enumeration value="KPI"/>
        </xsd:restriction>
      </xsd:simpleType>

	  <xsd:complexType name="GenericMetaData">
			<xsd:sequence>
				<xsd:element name="type" type="red:GenericDataType" />
				<xsd:element name="version" type="xsd:string" />
				<xsd:element name="param" type="xsd:string" minOccurs="0"
					maxOccurs="unbounded" />
			</xsd:sequence>
	  </xsd:complexType>

	  <xsd:element name="GenericMetaDataElement" type="red:GenericMetaData"/>
	  
	  <xsd:element name="GenericData">
	     <xsd:complexType>
	     	<xsd:sequence>
	     		<xsd:element name="metadata" type="red:GenericMetaData"/>
	  			<xsd:element name="data" type="xmime:base64Binary"/>
	     	</xsd:sequence>
	     </xsd:complexType>
	  </xsd:element>

---

xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
xmlns:red=<this schema's namespace>

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


Mime
View raw message