You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Ron Ten-Hove (JIRA)" <ji...@apache.org> on 2015/10/17 02:30:05 UTC

[jira] [Commented] (CAMEL-9230) CXFRS NPE when response code not in Response.Status

    [ https://issues.apache.org/jira/browse/CAMEL-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14961580#comment-14961580 ] 

Ron Ten-Hove commented on CAMEL-9230:
-------------------------------------

Test fails with:
{code}
java.lang.AssertionError: Exception should be a CxfOperationException
Expected: an instance of org.apache.camel.component.cxf.CxfOperationException
     but: <java.lang.NullPointerException> is a java.lang.NullPointerException
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.junit.Assert.assertThat(Assert.java:865)
	at org.apache.camel.component.cxf.jaxrs.CxfRsProducerTest.testProducer422Response(CxfRsProducerTest.java:493)
        ,,,
{code}

> CXFRS NPE when response code not in Response.Status
> ---------------------------------------------------
>
>                 Key: CAMEL-9230
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9230
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cxfrs
>    Affects Versions: 2.15.3
>            Reporter: Ron Ten-Hove
>              Labels: patch
>         Attachments: CAMEL-9230-reproduction.patch, CAMEL-9230.patch
>
>
> When used as a producer, the CXFRS component's {{org.apache.camel.component.cxf.jaxrs.CxfRsProducer#populateCxfRsProducerException}} method converts the received HTTP response status code to text:
> {{String statusText = Response.Status.fromStatusCode(responseCode).toString();}}
> If the JAX-RS-supplied {{fromStatusCode}} method does not recognize the status code provided, it returns {{null}}, causing the CxfRsProducer to throw an NPE. 
> Note that {{Response.Status}} does not encompass all response codes. I ran afoul of this when a REST service returned a 422 for a validation error.
> I will attach a unit test that illustrates this problem, as a patch to the current unit tests for the class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)