users@jsr311.java.net

Re: Telling ExceptionMapper to exclude exceptions

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 14 Oct 2008 09:09:59 +0200

On Oct 14, 2008, at 2:37 AM, cowwoc wrote:

> 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?
>

There is, but currently it is not covering this aspect. The scope of
the TCK will be improved.


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

Thanks,
Paul.