jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] can't log console message on thrown exceptions

From: Bill Burke <bburke_at_redhat.com>
Date: Fri, 22 Feb 2013 09:40:53 -0500

On 2/21/2013 11:42 AM, Marek Potociar wrote:
>
> On Feb 21, 2013, at 3:16 PM, Bill Burke <bburke_at_redhat.com> wrote:
>
>> http://java.net/jira/browse/JAX_RS_SPEC-339
>>
>> The WebApplicationException hierarchy has no constructors for setting Exception.getMessage() value. This really sucks as I often find I want a nice message that describes why the exception was thrown to be shown in my console and/or server log file.
>>
>> To get around this problem you have to do something like this:
>>
>> throw new ForbiddenException(new Exception("The token didn't have valid permission"));
>>
>> I think this would be trivial to fix and important to solve to make console and log files more readable.
>
> I have looked at it and it's not that simple as doing it blindly may introduce some stupid mistakes in the API. So one needs to be careful where are the new constructors added as well as many new versions of the existing constructors have to be provided, with all the javadoc etc.
>
> So, feel free to provide a patch if you have time for it. I'm quite swamped with less trivial stuff in the RI at the moment.
>

Working on it now. I'll submit a pull request by end of day. You're
right, it is easy to do, but a bit of work given all the constructors
you have add.

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com