[jax-rs-spec users] Re: Exception mapper ambiguity

From: Sebastian Daschner <>
Date: Tue, 26 Jul 2016 18:06:33 +0200

Hi Christian,

Sorry for the late response.

+1 for being able to specify the exception mappers via @Priority. But if
we add this feature I think we should at least think of other potential
candidates for ordering / selecting as well such as
Reader/WriterInterceptors or MessageBodyReaders/Writers. WDYT?


On 07/18/2016 09:06 AM, Christian Kaltepoth wrote:
> Hey all,
> I just stumbled upon a minor inaccuracy in the specification. The
> matching algorithm of an exception to an exception mapper is defined
> like this:
> 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.
> That's all. So the spec currently does not define which mapper is
> selected if there are multiple ones for the same exception type. This
> is problematic if there are multiple ones provided by the JAX-RS
> implementation, 3rd party libraries or by the application itself.
> This could be fixed if the JAX-RS specifies that in these cases the
> @Priority annotation can be used to order the mappers. I think this
> pattern is widely adopted in Java EE. We also use @Priority for
> ordering SPIs in MVC 1.0.
> Thoughts?
> Christian
> --
> Christian Kaltepoth
> Blog:
> Twitter:
> GitHub: