[
https://issues.apache.org/jira/browse/MATH-1467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16595843#comment-16595843
]
Gilles commented on MATH-1467:
------------------------------
{quote}is it a big deal?
{quote}
IMO, no. But it is a bit strange to single out a special case.
Moreover, I think that the problem is more general: we should not use
exception when a key is missing or misspelled since it is discarded anyway.
Please have a look at the fix in commit
34bd1707749c71302207fb2fc0559b6ca301d895
No more useless exceptions for "English", but it will load the (empty) bundle
every time a message is requested. For "English" is certainly a performance
hit. However, it is a general issue with {{getLocalizedMessage(Locale)}}. If
you are only interested in the "English" message (?), perhaps your code should
call {{getMessage()}}.
> Avoid throwing exceptions when using default locale
> ---------------------------------------------------
>
> Key: MATH-1467
> URL: https://issues.apache.org/jira/browse/MATH-1467
> Project: Commons Math
> Issue Type: Improvement
> Affects Versions: 3.6.1
> Reporter: Gregory Jevardat
> Priority: Major
> Attachments: LocalizedFormats.java, LocalizedFormatsTest.java
>
>
> In the LocalizedFormats class the method getLocalizedString systematically
> throws an exception when the US or EN locale is used.
> It occurs because it tries to load the bundle in any case and obviously the
> properties file for EN does not exist.
> Maybe a little check if an EN locale is used and then returning the
> sourceFormat would avoid trying to load the bundle and throw exceptions.
> In my case we have intensive (billions) statistical computations and Java
> Mission Control reports 10-100k's of MissingResourcesExceptions caused by
> that.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)