Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9230

CXFRS NPE when response code not in Response.Status

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Unknown

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            davsclaus Claus Ibsen
            rtenhove Ron Ten-Hove
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment