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] [Created] (CAMEL-7069) Sending an empty soap body message to a generic provider camel-dxf consumer results in NPE
Date Fri, 13 Dec 2013 19:09:07 GMT
Aki Yoshida created CAMEL-7069:
----------------------------------

             Summary: Sending an empty soap body message to a generic provider camel-dxf 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.4#6159)

Mime
View raw message