uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Schor (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-5961) InternationalizedException getLocalizedMessage fails in pear
Date Mon, 01 Jul 2019 18:38:00 GMT

    [ https://issues.apache.org/jira/browse/UIMA-5961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16876416#comment-16876416
] 

Marshall Schor commented on UIMA-5961:
--------------------------------------

The above approach isn't a general solution because:

The lifecycle of an exception can be unusual (as it is in this case:
   1) the exception is created with a particular calling stack
   2) the stack is unwound (via throw, or return) to some earlier point
   3) after that unwinding, a call is made to get the "localized" messaged from the exception. 
This call passes in a "locale" (optionally).

The (3) lookup, because it may be based on a locale specified at that moment, means the lookup
of the bundle (which can depend on the locale) is done in a context where the original calling
stack has been lost (unwound).

If we can know the locale to use, we could look up the bundle before the stack is unwound. 
But if the locale is passed in as an argument, this won't work perfectly.  A work-around
would be to lookup the bundle at exception-creation-time, with the locale to use, if it is
not the default.

In the test example, the lookup of the internationalized message is done because of this statement
in PrimitiveAnalysisEngine_impl:  
{code:java}
logger.log(Level.SEVERE, "", e);{code}
which calls the toString method on the exception (e), which in turn gets the localized message
using the default locale.

> InternationalizedException getLocalizedMessage fails in pear
> ------------------------------------------------------------
>
>                 Key: UIMA-5961
>                 URL: https://issues.apache.org/jira/browse/UIMA-5961
>             Project: UIMA
>          Issue Type: Bug
>    Affects Versions: 2.10.3SDK
>            Reporter: Matthias Koch
>            Assignee: Marshall Schor
>            Priority: Major
>             Fix For: 2.10.4SDK
>
>         Attachments: UIMA-5961.diff, peartest.zip
>
>
> localized message does not work in the case of pears. The classloader stored in the internationalizedException
is wrong. The bundle cant be found in this classloader.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message