commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory Jevardat (JIRA)" <>
Subject [jira] [Commented] (MATH-1467) Avoid throwing exceptions when using default locale
Date Wed, 29 Aug 2018 08:03:01 GMT


Gregory Jevardat commented on MATH-1467:


I saw you commit and I think it it ok. Actually I was not super fan of my solution with hard
coded guard.


FYI I call getMessage() wich in turns call getMessage(Locale.US) in ExceptionContext class.
So in the end it relies on BundleResource...

I think the ultimate solution that would not involve adding an empty properties file is to
overload the ResourceBundle.Control subclass and provides custom method to check for existence
of specific locale resources. I did not wanted to spend to much time on this so for me it
is ok like that. See for instance []

Another point should this fix be backported to 3.6 branches ?



> Avoid throwing exceptions when using default locale
> ---------------------------------------------------
>                 Key: MATH-1467
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.6.1
>            Reporter: Gregory Jevardat
>            Priority: Major
>         Attachments:,
> 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

View raw message