• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

getLocalizedMessage() of Throwable class

 
Ranch Hand
Posts: 658
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what and how to write in getLocalizedMessage(), as normally if we don't override this method, it exactly print the information provided by the getMessage().
I have also read the Locale class, but not found any hint
can someone please explain it with code ?
thank you
 
Marshal
Posts: 76888
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds as though you are supposed to create some sort of translation of the ordinary message to a different language.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Puspender Tanwar wrote:what and how to write in getLocalizedMessage(), as normally if we don't override this method, it exactly print the information provided by the getMessage().


As it says in the docs. It only applies to a subclass that specifically overrides it.

can someone please explain it with code ?


Very simplistically:although how useful it is I don't know.

Winston
 
Sheriff
Posts: 22702
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More like the following:
Depending on the locale and the available translation files ("my/pkg/myexception_en_US.properties" etc), this returns a message in English, French, or whatever is available.
 
reply
    Bookmark Topic Watch Topic
  • New Topic