--- [EMAIL PROTECTED] wrote:
> On Wed, 21 Mar 2001, Mel Martinez wrote:
> 
> > Would the following be an acceptable solution?
> > 
> > We change the
> > Constants.message(key,args,verbosityLevel) method
> > behavior so that if getString(key,args) throws
> > a missing resource exception that it logs using
> the
> > key itself as the log message. Note that this
> would
> > also require changing the getString() method to
> throw
> > the MissingResourceException instead of the Error
> > object that it currently throws.  
> 
> +1 ( please check the tomcat side is doing the
> same - we never had the problem but you never know )
> 
> Would StringManager be a better place for the fix ?
> 
> Costin


Yes.  After looking into this, it would seem that
there is no reason Jasper can't make use of
StringManager to handle getting it's resource strings
consistent with the way tomcat packages are doing so. 
This doesn't look too difficult to retro into Jasper.

However ...

StringManager's getString() currently deals with the
MissingResourceException by simply returning a String
consisting of a warning message about not being able
to find the particular key.  I don't think that is
correct behavior.  I think it should throw the
MissingResourceException or return null and that
calling code should deal with it.  Otherwise the
calling code really has no reason to suspect anything
is wrong (that the returned string is not what it
wanted).  If an exception were to be thrown and caught
(or a null is checked and found) then the calling code
wuld have the option to use the key to construct a
replacement String or whatever.  However, I am a bit
leary about changing code to throw an exception where
one has been incorrectly swallowed like this. 
Currently unsuspecting code may exist that relies
unknowingly on this swallowing of the exception by
blindly just using whatever string is returned.

Changing this may require a bit of testing to see all
the effects caused by missing resource strings.

Mel


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Reply via email to