commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd V. Jonker" <t...@consciouscode.com>
Subject Re: [lang] i18n package proposal
Date Wed, 04 Feb 2004 19:19:20 GMT
Actually, Hen, it was _intended_ to say that implementations are
Throwable.  The intent is for one to write custom exceptions like this:

class MyException
    implements LocalizedThrowable
    extends Exception
{
    ...
    public String getMessage()
{

}

Of course it would be clearer it Throwable were an interface that once
could extend...



On Fri, 30 Jan 2004 14:19:58 -0500 (EST), "Henri Yandell"
<bayard@generationjava.com> said:
> 
> Bad name, implies it's a Throwable but it's not. Also you wouldn't want
> to
> make it extend that.
> 
> LocalizedMessageSource? and change getResourceKey to getMessageKey ?
> 
> Other names: LocalizedMessagable   LocalizedThrowableMessagable etc.
> 
> [not that I'm agreeing with the interface's need, just suggesting a
> change
> to the proposal]
> 
> Hen
> 
> On Fri, 30 Jan 2004, Todd V. Jonker wrote:
> 
> > [Sorry, premature message send.]
> >
> >
> > Mark R. Diggory wrote:
> > > I don't think logging should be used for anything more than debugging
> > > purposes.
> >
> > J.Pietschmann said:
> > > Me too. I used the code snippet as an example of a typical application
> > > level exception handling.
> >
> >
> > I don't think a library must bend over backwards to support the poor
> > programming practices of its users.  That kind of poor exception handling
> > is a well-documented anti-pattern.
> >
> > In any case, it shouldn't be the exception's responsibility to locate
> > resource bundles or message formats.  Remember that localized log entries
> > are only possible if the logging system supports it.
> >
> > How about something like:
> >
> > interface LocalizedThrowable
> > {
> >     /** Returns a key for retrieving an appropriate MessageFormat. */
> >     public String getResourceKey();
> >
> >     /** Renders a localized message for this exception. */
> >     public String formatMessage(MessageFormat format);
> > }
> >
> > This would provide an appropriate hook for the logging system to lookup
> > the localized message and format it.
> >
> > .T.
> >
> > --
> > Todd V. Jonker
> >
> > Conscious Code Ltd
> > Thoughtful Software Development
> > www.consciouscode.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message