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

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

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Thu, 21 Feb 2013 17:42:07 +0100

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.

Marek

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