Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5534

ProviderFactory returns incorrect ExceptionMapper when no exact match is registered

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

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7.8
    • 2.7.9
    • JAX-RS
    • None
    • Unknown

    Description

      The JAX-RS 1.1 spec says:

      When choosing an exception mapping provider to map an exception, an implementation MUST use the provider whose generic type is the nearest superclass of the exception.

      In 2.7.0, this was working per the spec. In 2.7.8 (likely starting with 2.7.6, but not tested), the FIRST ExceptionMapper provider is returned when there is no exact match. This usually results in a ClassCastException.

      In the attached test, a NullPointerException should map to the registered ExceptionMapper<RuntimeException> provider, but it does not.

      Attachments

        Activity

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

          People

            sergey_beryozkin Sergey Beryozkin
            hweisheimer Hans Weisheimer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment