users@jsr311.java.net

Re: Telling ExceptionMapper to exclude exceptions

From: cowwoc <cowwoc_at_bbs.darktech.org>
Date: Mon, 13 Oct 2008 20:37:37 -0400

On Oct 13, 2008, at 7:46 PM, Paul Sandoz wrote:

> On Oct 13, 2008, at 7:15 PM, Marc Hadley wrote:
>
>> On Oct 13, 2008, at 12:07 PM, cowwoc wrote:
>>>
>>> Under Jersey, ExceptionMapper<RuntimeException> gets called even
>>> for Jersey internal exceptions, such as
>>> *com.sun.jersey.api.container.ContainerException.
>>
>> Does the stack trace include a resource or provider method ? I'm
>> wondering about the origin of the exception. You should only be
>> seeing exceptions that originate in the context of a resource or
>> provider method or in the creation of a resource method parameter,
>> field or property value.
>>
>
> I think there is a bug in Jersey it does not differentiate based on
> where the exception originates.
>
> Paul.


        Section 4.4 of the specification reads:

When a resource class or provider method throws an exception, the JAX-RS runtime will attempt to map the
exception to a suitable HTTP response[...]

        so my interpretation is the same as yours, that Jersey should not be passing these exceptions to ExceptionMapper. Is there a TCK for JSR311 to ensure that other implementations do not make this mistake?

        For now, I filed a bug against Jersey: https://jersey.dev.java.net/issues/show_bug.cgi?id=126

Gili