uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Lally" <ala...@alum.rpi.edu>
Subject Re: Class loading issue with ResourceBundle
Date Mon, 12 Nov 2007 15:42:56 GMT
Hi Michael,

On Nov 12, 2007 10:28 AM, Michael Baessler <mba@michael-baessler.de> wrote:
> <snip/>
>
> when the exception message is localized, the method
> getLocalizedMessage() is called on the MyException object. The
> getLocalizedMessage() method is not implemented in the MyException
> class, it is inherited from the InternationalizedException class.
>
>     public String getLocalizedMessage() {
>       ....
>       ResourceBundle.getBundle(bundleName, locale);
>       ....
>     }
>
> If getLocalizedMessage() method is called, the getBundle(bundleName,
> locale) method resolves the classloader that is used to resolve the
> bundleName. In our case the classloader of the class
> InternationalizedException is used here since there the
> getLocalizedMessage() method is defined. But this is in case of the
> UIMAClassloader usage not the classloader of the MyException object that
> should be used here, at least if we trust the JavaDocs. To solve this
> issue we can easily hand over the MyException object classloader to the
> getBundle() method like:
>
>     ResourceBundle.getBundle(bundleName, locale,
> this.getClass().getClassloader());
>

Hmmm... the JavaDocs for ResourceBundle.getBundle(bundleName, locale) say:

Calling this method is equivalent to calling
    getBundle(baseName, locale, this.getClass().getClassLoader()),


So it doesn't seem like your proposed change would do anything.  And
also it seems like what's there now ought to be working.  Do you have
a test case that demonstrates this not working?

-Adam

Mime
View raw message