diff --git a/hipparchus-core/src/changes/changes.xml b/hipparchus-core/src/changes/changes.xml index 676bf9159..679db6fac 100644 --- a/hipparchus-core/src/changes/changes.xml +++ b/hipparchus-core/src/changes/changes.xml @@ -49,6 +49,9 @@ If the output is not quite correct, check for invisible trailing spaces! Hipparchus Core Release Notes + + Fixed default Localizable.getLocalizedString when running on module path. + Restores a Java 8 compatible mockito version, which is used only for tests purposes; diff --git a/hipparchus-core/src/main/java/org/hipparchus/exception/Localizable.java b/hipparchus-core/src/main/java/org/hipparchus/exception/Localizable.java index d7a2c6115..50deee24e 100644 --- a/hipparchus-core/src/main/java/org/hipparchus/exception/Localizable.java +++ b/hipparchus-core/src/main/java/org/hipparchus/exception/Localizable.java @@ -59,7 +59,16 @@ public interface Localizable extends Serializable { default String getLocalizedString(final String baseName, final String key, final Locale locale) { try { - final ResourceBundle bundle = ResourceBundle.getBundle(baseName, locale, new UTF8Control()); + ResourceBundle bundle; + try { + bundle = ResourceBundle.getBundle(baseName, locale, new UTF8Control()); + } + catch (UnsupportedOperationException uoe) { + // fix for Java 9+ on module path + // (see issue https://github.com/Hipparchus-Math/hipparchus/issues/392) + bundle = ResourceBundle.getBundle(baseName, locale); + } + if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) { final String translated = bundle.getString(key);