[
https://issues.apache.org/activemq/browse/CAMEL-3343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63394#action_63394
]
Willem Jiang commented on CAMEL-3343:
-------------------------------------
Yes, It's a bug of camel-cxfrs, I just committed a quick fix for it and update
the CxfRsInvoker to use CXF 2.3.0 continuation API.
Please check out the latest Camel 2.6-SNAPSHOT for verification.
> CxfRsInvoker produces NullpointerException when no ContinuationProvider is
> set in the InMessage
> -----------------------------------------------------------------------------------------------
>
> Key: CAMEL-3343
> URL: https://issues.apache.org/activemq/browse/CAMEL-3343
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-cxf
> Affects Versions: 2.5.0
> Reporter: Boris Terzic
> Assignee: Willem Jiang
> Fix For: 2.6.0
>
>
> In my usage of CXF-RS with Camel through the camel-cxf component I ran into a
> NullpointerException, the specific case is described in some detail on
> StackOverflow:
> http://stackoverflow.com/questions/4198461/why-do-i-get-a-nullpointerexception-when-invoking-the-cxf-rs-endpoint-of-a-camel
>
> Specifically I run into a NullpointerException:
> {code:java}
> Caused by: java.lang.NullPointerException
> at
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.getContinuation(CxfRsInvoker.java:63)
> at
> org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:52)
> at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
> ... 33 more
> {code}
> I was assuming I was misconfiguring something but didn't find any alternative
> way so I started digging in the camel-cxf source code.
> I found that such a "getContinuation" method also exists for the
> {{org.apache.camel.component.cxf.CxfConsumer}} as well as for the
> CxfRsInvoker (where it was failing for me). However in the case of the
> CxfConsumer there is a guard on the ContinuationProvider so that if it is
> null, then null is returned:
> {code:java}
> return provider == null ? null : provider.getContinuation();
> {code}
> CxfRsInvoker does not have this guard, but it does have code to deal with a
> "null" Continuation at the calling site (line 52, in performInvocation).
> Therefore I assumed this was a bug and patched the guard into the
> CxfRsInvoker as well.
> My program now seems to work correctly. I assume this is a bug.
> For completeness sake, this is what getContinuation now looks like for me:
> {code:java}
> private Continuation getContinuation(Exchange cxfExchange) {
> ContinuationProvider provider =
>
> (ContinuationProvider)cxfExchange.getInMessage().get(ContinuationProvider.class.getName());
> return provider == null ? null : provider.getContinuation();
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.