Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1685

Resteasy client throws WebApplicationException when ClientRequestFilter is used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.0.24.Final, 3.1.4.Final
    • 3.0.23.Final, 3.1.3.Final
    • None
    • None
    • Hide

      Test ClientExceptionsTest.requestFilterThrowsCustomExceptionTest() reproduces the issue:

      git clone https://github.com/kanovotn/Resteasy.git
      cd Resteasy
      git checkout RESTEASY-1685
      mvn clean install -DskipTests
      cd testsuite
      mvn clean verify -Dtest=ClientExceptionsTest#requestFilterThrowsCustomExceptionTest -Dmaven.test.redirectTestOutputToFile=false
      
      Show
      Test ClientExceptionsTest.requestFilterThrowsCustomExceptionTest() reproduces the issue: git clone https: //github.com/kanovotn/Resteasy.git cd Resteasy git checkout RESTEASY-1685 mvn clean install -DskipTests cd testsuite mvn clean verify -Dtest=ClientExceptionsTest#requestFilterThrowsCustomExceptionTest -Dmaven.test.redirectTestOutputToFile= false

    Description

      Resteasy client should throw according to JAXRS 2.0 spec (4.5.2 Client Runtime):

      ProcessingException if thrown while processing a request, and to a ResponseProcessingException if thrown while processing a response.

      But Custom implementation of ClientRequestFilter which throws WebApplicationException doesn't get mapped into ProcessingException as the spec says but into WebApplicationException.

      WebApplicationException should be thrown by client only when ( JAXRS 2.0 spec - 4.5.2 Client Runtime):

      Note that the client runtime will only throw an instance of WebApplicationException (or any of its subclasses) as a result of a response from the server with status codes 3xx, 4xx or 5xx.

      The example of ClientRequestFilter:

      public class RequestFilterThrowCustomException implements ClientRequestFilter {
      
          @Override
          public void filter(ClientRequestContext requestContext) {
              throw new WebApplicationException();
          }
      }
      

      Client call:

      ClientBuilder.newClient().target(dummyUrl).register(RequestFilterThrowCustomException.class).request().get();
      

      Results to WebApplicationException being thrown.

      Opposite to this when WebApplicationException is thrown by ClientResponseFilter, Resteasy client throws ResponseProcessingException as described in the spec.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-asoldano Alessio Soldano
              kanovotn Katerina Odabasi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: