camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aki Yoshida (JIRA)" <>
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
             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(
	at org.apache.camel.component.cxf.converter.NodeListWrapper.getLength(
	at org.apache.camel.converter.jaxp.DomConverter.toString(
	at org.apache.camel.converter.jaxp.DomConverter.toByteArray(
	at org.apache.camel.converter.jaxp.DomConverter.toInputStream(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(

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

View raw message