Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

A general question about java.lang.Throwable

980857Dec 19 2012 — edited Dec 23 2012
Hello 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.
This post has been answered by Kayaman on Dec 20 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 20 2013
Added on Dec 19 2012
12 comments
189 views