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 2008/05/08 14:44:56 UTC

[jira] Commented: (WSCOMMONS-341) When serializing CDATA STAX Parser throws IllegalArgumentException

    [ https://issues.apache.org/jira/browse/WSCOMMONS-341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595218#action_12595218 ] 

Rich Scheuerle commented on WSCOMMONS-341:
------------------------------------------

I agree that a null should not be returned.

I will commit the simple WSCOMMONS-338 patch after I complete the Axiom and Axis2 tests.  My only concern with the patch is whether it properly reads and adds the 
![CDATA[...]].

It would be helpful if you supplied a testcase that verified the proper execution of the code.   Not only will this verify that the problem is fixed according to your scenario, it also helps ensure that your scenario is not regressed by future changes.



> When serializing CDATA STAX Parser throws IllegalArgumentException
> ------------------------------------------------------------------
>
>                 Key: WSCOMMONS-341
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-341
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Tim Mitchell
>            Assignee: Rich Scheuerle
>
> We are hitting a problem when a SOAPEnvelope containing CDATA is serialised using the SOAPEnvelope.serializeAndConsume():
> java.lang.IllegalArgumentException: The specified CDATA text was null.
> 	at com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwIllegalArgumentException(StAXMessageProvider.java:41)
> 	at com.ibm.xml.xlxp.api.stax.XMLStreamWriterImpl.writeCData(XMLStreamWriterImpl.java:675)
> 	at com.ibm.xml.xlxp.api.stax.XMLOutputFactoryImpl$XMLStreamWriterProxy.writeCData(XMLOutputFactoryImpl.java:163)
> 	at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeCData(MTOMXMLStreamWriter.java:212)
> 	at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeCData(StreamingOMSerializer.java:426)
> 	at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:137)
> 	at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:92)
> 	at org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:76)
> 	at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:572)
> 	at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:232)
> 	at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:958)
> 	at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:471)
> 	at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:68)
> 	at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
> 	at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
> 	at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
> 	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
> 	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
> 	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
> 	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
> 	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
> 	at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:542)
> 	at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:189)
> 	at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
> 	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:364)
> 	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:208)
> 	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:450)
> 	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
> 	at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
> 	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
> 	at org.prototype.PrototypeHTTPClient.sendMessage(PrototypeHTTPClient.java:275)
> I have debugged the problem and have found that in org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeCData() it does writer.writeCData(reader.getText());. The reader.getText() invokes the OMStAXWrapper.getText() which checks to see if it the currentElement  is of a certain type, and CData isn't one of the types it checks, so it returns null, and this causes the exception.
> Should the CDATA type be added to hasText() ? 

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