File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
hipparchus-core/src/main/java/org/hipparchus/exception Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 23
23
24
24
import java .io .Serializable ;
25
25
import java .util .Locale ;
26
+ import java .util .MissingResourceException ;
26
27
import java .util .ResourceBundle ;
27
28
28
29
/**
@@ -57,15 +58,19 @@ public interface Localizable extends Serializable {
57
58
*/
58
59
default String getLocalizedString (final String baseName , final String key , final Locale locale ) {
59
60
60
- final ResourceBundle bundle = ResourceBundle .getBundle (baseName , locale , new UTF8Control ());
61
- if (bundle .getLocale ().getLanguage ().equals (locale .getLanguage ()))
62
- {
63
- final String translated = bundle .getString (key );
64
- if (!(translated .isEmpty () || translated .toLowerCase ().contains ("missing translation" )))
61
+ try {
62
+ final ResourceBundle bundle = ResourceBundle .getBundle (baseName , locale , new UTF8Control ());
63
+ if (bundle .getLocale ().getLanguage ().equals (locale .getLanguage ()))
65
64
{
66
- // the value of the resource is the translated format
67
- return translated ;
65
+ final String translated = bundle .getString (key );
66
+ if (!(translated .isEmpty () || translated .toLowerCase ().contains ("missing translation" )))
67
+ {
68
+ // the value of the resource is the translated format
69
+ return translated ;
70
+ }
68
71
}
72
+ } catch (MissingResourceException mre ) { // NOPMD
73
+ // do nothing here
69
74
}
70
75
71
76
// either the locale is not supported or the resource is not translated, or
You can’t perform that action at this time.
0 commit comments