NPE from DefaultCxfBinding when <soap:Body/> is null 
-----------------------------------------------------

                 Key: CAMEL-4649
                 URL: https://issues.apache.org/jira/browse/CAMEL-4649
             Project: Camel
          Issue Type: Bug
          Components: camel-cxf
    Affects Versions: 2.8.2
         Environment: Win 7, JDK1.6
            Reporter: Xilai Dai


when got soap message from CXF component like this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
<soap:Header>
......
</soap:Header>
<soap:Body/>
</soap:Envelope>

the NPE will be thrown: 

18:04:51,255 | WARN  | tp1212500935-153 | ache.cxf.common.logging.LogUtils  372 
|  -  -  | Interceptor for 
{http://airportsoap.sopera.de}airport#{http://airportsoap.sopera.de}getAirportInformationByISOCountryCode
 has thrown exception, unwinding now
java.lang.NullPointerException
        at 
org.apache.camel.component.cxf.DefaultCxfBinding.getResponsePayloadList(DefaultCxfBinding.java:395)[163:org.apache.camel.camel-cxf:2.8.2]
        at 
org.apache.camel.component.cxf.DefaultCxfBinding.populateCxfResponseFromExchange(DefaultCxfBinding.java:318)[163:org.apache.camel.camel-cxf:2.8.2]
        at 
org.apache.camel.component.cxf.CxfConsumer$1.setResponseBack(CxfConsumer.java:176)[163:org.apache.camel.camel-cxf:2.8.2]
        at 
org.apache.camel.component.cxf.CxfConsumer$1.asyncInvoke(CxfConsumer.java:103)[163:org.apache.camel.camel-cxf:2.8.2]
        at 
org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:68)[163:org.apache.camel.camel-cxf:2.8.2]
        at 
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[141:org.apache.cxf.bundle:2.5.0]
        at 
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93)[141:org.apache.cxf.bundle:2.5.0]
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)[141:org.apache.cxf.bundle:2.5.0]
        at 
org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:232)[141:org.apache.cxf.bundle:2.5.0]
        at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:80)[141:org.apache.cxf.bundle:2.5.0]
        at 
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:323)[141:org.apache.cxf.bundle:2.5.0]
        at 
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:289)[141:org.apache.cxf.bundle:2.5.0]
        at 
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[141:org.apache.cxf.bundle:2.5.0]
        at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:939)[59:org.eclipse.jetty.server:7.4.5.v20110725]
        at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)[59:org.eclipse.jetty.server:7.4.5.v20110725]
        at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[59:org.eclipse.jetty.server:7.4.5.v20110725]
        at 
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:185)[59:org.eclipse.jetty.server:7.4.5.v20110725]
        at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)[59:org.eclipse.jetty.server:7.4.5.v20110725]
        at 
org.eclipse.jetty.server.Server.handleAsync(Server.java:391)[59:org.eclipse.jetty.server:7.4.5.v20110725]
        at 
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:594)[59:org.eclipse.jetty.server:7.4.5.v20110725]
        at 
org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:393)[59:org.eclipse.jetty.server:7.4.5.v20110725]
        at 
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)[54:org.eclipse.jetty.io:7.4.5.v20110725]
        at 
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)[54:org.eclipse.jetty.io:7.4.5.v20110725]
        at 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)[53:org.eclipse.jetty.util:7.4.5.v20110725]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]


Looking into the source codes, before the line 395 of DefaultCxfBinding, the 
elements variable shoulde be checked if it's null.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to