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

Default Exception mapper is picked even if the custom exception mapper exists

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 3.0.21.Final
    • jaxrs
    • None

    Description

      I am using ReasyEasy as the Provider.And in my code i have defined a custom exception mapper some thing like this
      public class CustomExceptionMapper implements ExceptionMapper<Exception > {

      @Override
      public Response toResponse(final Exception exception) {
      //have my own logic to map the error response to a JSON format
      }
      }
      I have the following jars in my project
      resteasy-clinet (3.0.21)
      resteasy-spring (3.0.21)
      resteasy-jaxrs(3.0.21)
      resteasy-jackson2-provider (3.0.21)

      So for unrecognized field exception i was expecting it would be caught in my custom exception mapper.How ever when i debugged in it
      It reaches to the following class
      @Provider
      public class UnrecognizedPropertyExceptionHandler implements ExceptionMapper<UnrecognizedPropertyException> {
      @Override
      public Response toResponse(UnrecognizedPropertyException exception)

      { return Response.status(HttpResponseCodes.SC_BAD_REQUEST) .type(MediaType.TEXT_HTML) .entity(exception.getOriginalMessage()) .build(); }

      }

      which is part of reasteasy-jacson2-provider.3.0.21-final

      the problem there is it is sending the message plain text_html how ever i want a proper JSON.

      I am not sure why it is not triggered .Rest all other types of exceptions lie runtime exceptions or any custom exceptions are caught in my custom exception mapper but not for this one.

      Is there any thing i am doing wrong here..?

      Attachments

        Issue Links

          Activity

            People

              kanovotn Katerina Odabasi (Inactive)
              swatigudla swati gudla (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: