geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Hawtin <thaw...@tackline.demon.co.uk>
Subject Re: Hardcoded message strings
Date Mon, 18 Aug 2003 23:09:24 GMT
Jason Dillon wrote:
> Yes we should, please submit a patch (someone).

It appears that very few programs put there exception messages in 
resource bundles. I guess we expect anyone who reads them to be a 
programmer and be able to read English even if not quite like a native. 
Also it's easier to edit the messages if they're inline. But I won't let 
that stop me.

Attached is my stab at an answer. Some notes for discussion:

  o If you tried replicating for a number of exceptions, the code 
duplication would get horrific (and not even generics will save you). 
I'm quite prepared to put together some XSLT, say, if necessary.
  o Current version puts everything (ever) in one resource file. However 
from previous point, it may need replicating for each 
project/subproject/package anyway.
  o Might want to produce messages in a locale different from machine 
set one (perhaps even do it a print time rather than throw time).
  o Various points on generation of methods lazily and reuse of 
MessageFormats can be criticised. Is there a better/more appropriate 
formatter?
  o I've put in an option not to fillInStackTrace (if using lazy message 
formatting), but that's probably asking for trouble. Of course such code 
can easily be chopped out.

Tom Hawtin

Mime
View raw message