camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aki Yoshida (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-7069) Sending an empty soap body message to a generic provider camel-cxf consumer results in NPE
Date Tue, 28 Jan 2014 17:51:37 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-7069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13884360#comment-13884360
] 

Aki Yoshida commented on CAMEL-7069:
------------------------------------

After some pause (forgot about this ticket), I thought about those options again.
Since some of the CXF payload conversion methods and NodeList conversion methods assume the
body (of the CxfPayload) to be not null, option 3 will require many changes in those converters
to avoid NPE. Option 1 would introduce a redundant way of creating an empty cxf payload (either
passing null or an empty list). So, I think we can opt for option 2 and change the getPayloadBodyElements
method so that normal scenarios resulting a null camel body will not result in NPE at cxf
payload instantiation.




> Sending an empty soap body message to a generic provider camel-cxf consumer results in
NPE
> ------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-7069
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7069
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cxf
>    Affects Versions: 2.12.2
>            Reporter: Aki Yoshida
>            Assignee: Aki Yoshida
>
> In some cases, CXFPayload is instantiated with a null body and this is causing an NPE
later in the processing.
> Caused by: java.lang.NullPointerException
> 	at org.apache.camel.component.cxf.CxfPayload$1.size(CxfPayload.java:105)
> 	at org.apache.camel.component.cxf.converter.NodeListWrapper.getLength(NodeListWrapper.java:33)
> 	at org.apache.camel.converter.jaxp.DomConverter.toString(DomConverter.java:69)
> 	at org.apache.camel.converter.jaxp.DomConverter.toByteArray(DomConverter.java:142)
> 	at org.apache.camel.converter.jaxp.DomConverter.toInputStream(DomConverter.java:137)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> What is not sure is how we should fix it.
> CXFPayload is not checking whether the body is null when it is instantiated. In that
case, some methods will lead to NPE but some are not (like getBodySources() or getHeaders()).
And there are some test cases passing a null body.
> So I think, we should either 
> 1. change CXFPayload to automatically creates an empty body (i.e., an empty List<Source>)
when the body passed to the constructor is null, or
> 2. add this null->empty handling in DefaultCXFBinding.getPayloadBodyElements when
extracting the body and pass an empty list to the CXFPayload constructor in this case, or
> 3. just throws a specific exception instead of NPE in this particular case.
> In any case, we need to clarify what is the correct usage of CXFPayload.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message