JDK 8 code review request for 6380161 (reflect) Exception from newInstance() not chained to cause.

David Schlosnagle schlosna at gmail.com
Mon Aug 8 21:28:00 UTC 2011


On Mon, Aug 8, 2011 at 4:57 PM, Sebastian Sickelmann
<sebastian.sickelmann at gmx.de> wrote:
> These ones are candidates for cleanup too, but i want to discuss if someone
> sees a good argument to not to change to
>    throw new InternalError(e.getMessage(),e);
>    or
>    throw new InternalError("Lorem ipsum",e);
>
> Also i don't completely understand why Throwable(Throwable cause) uses
> cause.toString() to fill the message instead of cause.getMessage().
> Can someone explain to me why?

If you look at Throwable.toString(), you'll see that it uses
Throwable.getLocalizedMessage() which allows for localized exception
messages, so I would avoid using getMessage() directly.

I'd also be interested in helping out making the Throwable and
Exception types provide the 4 consistent constructors if there are
committers that would help guide us.

- Dave



More information about the core-libs-dev mailing list