camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (JIRA)" <>
Subject [jira] Resolved: (CAMEL-3343) CxfRsInvoker produces NullpointerException when no ContinuationProvider is set in the InMessage
Date Thu, 18 Nov 2010 08:37:26 GMT


Willem Jiang resolved CAMEL-3343.

       Resolution: Fixed
    Fix Version/s: 2.6.0

> CxfRsInvoker produces NullpointerException when no ContinuationProvider is set in the
> -----------------------------------------------------------------------------------------------
>                 Key: CAMEL-3343
>                 URL:
>             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:

> Specifically I run into a NullpointerException:
> {code:java}
> Caused by: java.lang.NullPointerException
>         at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.getContinuation(
>         at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(
>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
>         ... 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.

View raw message