Raul Kripalani created CAMEL-5897:
-------------------------------------

             Summary: Nullcheck missing in CxfPayloadConverter
                 Key: CAMEL-5897
                 URL: https://issues.apache.org/jira/browse/CAMEL-5897
             Project: Camel
          Issue Type: Bug
          Components: camel-cxf
    Affects Versions: 2.10.3
            Reporter: Raul Kripalani
            Assignee: Raul Kripalani


There's a null-check missing in CxfPayloadConverter which triggers a NPE if the 
payload is the result from a SOAP Fault, in which case the CxfPayload object 
contains no body sources at all.

This bug was introduced in r1376523.

Stack trace, in this case what triggers type converters is Stream Caching, but 
it could happen in other cases where the FallbackConverter is utilized.

{code}
Exception in thread "default-workqueue-3" 
org.apache.camel.TypeConversionException: Error during type conversion from 
type: org.apache.camel.component.cxf.CxfPayload to the required type: 
org.apache.camel.StreamCache with value 
org.apache.camel.component.cxf.CxfPayload headers: []body: null due 
java.lang.NullPointerException
        at 
org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:126)
        at 
org.apache.camel.core.osgi.OsgiTypeConverter.convertTo(OsgiTypeConverter.java:102)
        at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:72)
        at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
        at 
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:46)
        at 
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
        at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
        at 
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
[...]
org.apache.camel.component.cxf.CxfClientCallback.handleException(CxfClientCallback.java:82)
        at 
org.apache.cxf.interceptor.ClientOutFaultObserver.onMessage(ClientOutFaultObserver.java:59)
        at 
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1540)
        at 
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:426)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at 
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:351)
        at java.lang.Thread.run(Thread.java:680)
Caused by: org.apache.camel.RuntimeCamelException: 
java.lang.NullPointerException
        at 
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1271)
        at 
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:927)
        at 
org.apache.camel.impl.converter.StaticMethodFallbackTypeConverter.convertTo(StaticMethodFallbackTypeConverter.java:50)
        at 
org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:289)
        at 
org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:111)
        ... 56 more
Caused by: java.lang.NullPointerException
        at 
org.apache.camel.component.cxf.converter.CxfPayloadConverter.convertTo(CxfPayloadConverter.java:150)
        at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:923)
        ... 59 more
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to