A general question about java.lang.Throwable
980857Dec 19 2012 — edited Dec 23 2012Hello Everybody,
Recently I have been involved into internationalization and localization on the Java platform for the first time.
In the course of this I have been wondering why java.lang.Throwable does not provide a way to specify a localized message. We have getter getLocalizedMessage() right available but no setter counterpart. Yet for cause there is a initCause method.
That is in order to make getLocalizedMessage() return a sensible message you will have to sub class Throwable and implement corresponding logic.
None the builtin Java exceptions, e.g. IllegalArgumentException, does provide support for a localized message out of the box. So as I see it: If I want to have a localized version of one of those I will have to sub class.
Does anybody have a reasoning for that, respectively what was the intent of the Java developers.