Thilo Goetz | 18 May 20:34
Picon
Picon

Re: InternationalizedException doesn't look for resources in extension ClassLoader

Kirk True wrote:
> Hi all,
> 
> Summary:
> 
> org.apache.uima.InternationalizedException's getLocalizedMessage
> doesn't account for the use of an "extension" class path when loading
> message resources. For applications that use extension class paths, the
> resource is therefore not found.
[...]

Yes, that's a known issue.  There is one trick you can use: don't use
InternationalizedException directly, but inherit from it.  Bundle this
exception class with your pear.  Since message localization is done in
the exception class, the correct class loader will then be used and
your message bundle will be found.  It's a bit of a hack, but it works ;-)

--Thilo

Kirk True | 18 May 20:43
Gravatar

Re: InternationalizedException doesn't look for resources in extension ClassLoader

Hi Thilo,

> Yes, that's a known issue.  There is one trick you can use: don't use
> InternationalizedException directly, but inherit from it.  Bundle
> this
> exception class with your pear.  Since message localization is done
> in
> the exception class, the correct class loader will then be used and
> your message bundle will be found.  It's a bit of a hack, but it
> works ;-)

Thanks for the fast reply!

Is there a bug report listed somewhere? I looked for it, but didn't
find anything. 

Thanks for the workaround. My concern is that since we want to "host"
arbitrary annotators from third parties, etc. *their* annotators won't
implement the trick and thus fail :(

Thanks!!!

Kirk

Adam Lally | 21 May 15:43
Picon

Re: InternationalizedException doesn't look for resources in extension ClassLoader

On 5/18/07, Kirk True <kirk@...> wrote:
> Hi Thilo,
>
> > Yes, that's a known issue.  There is one trick you can use: don't use
> > InternationalizedException directly, but inherit from it.  Bundle
> > this
> > exception class with your pear.  Since message localization is done
> > in
> > the exception class, the correct class loader will then be used and
> > your message bundle will be found.  It's a bit of a hack, but it
> > works ;-)
>
> Thanks for the fast reply!
>
> Is there a bug report listed somewhere? I looked for it, but didn't
> find anything.
>
> Thanks for the workaround. My concern is that since we want to "host"
> arbitrary annotators from third parties, etc. *their* annotators won't
> implement the trick and thus fail :(
>

I don't think we have a JIRA for this currently, feel free to open one.

However I don't think there is any simple fix possible here.  I think
we would need to add a new constructor to the
InternationalizedException, either that takes the
ResourceManager/ClassLoader (so the framework has access to the
extension class loader for this annotator), or which takes the
localized string (so that the internationalization can be done in the
(Continue reading)


Gmane