diff options
author | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2020-11-19 10:15:58 +0100 |
---|---|---|
committer | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2020-11-19 10:15:58 +0100 |
commit | d3b5b119873b9186857a8c324362437ce3828848 (patch) | |
tree | 630407e7bdcead9b965c6496b23836a003e937be /pdf-over-gui/src/main | |
parent | 636a0d443e8a257879b8a6199d4de79cba88abfa (diff) | |
download | pdf-over-d3b5b119873b9186857a8c324362437ce3828848.tar.gz pdf-over-d3b5b119873b9186857a8c324362437ce3828848.tar.bz2 pdf-over-d3b5b119873b9186857a8c324362437ce3828848.zip |
Improved code quality according to SonarLint
Diffstat (limited to 'pdf-over-gui/src/main')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Messages.java | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Messages.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Messages.java index 6271656c..c48337e6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Messages.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/Messages.java @@ -38,10 +38,7 @@ public class Messages { private static final String BUNDLE_NAME = "at.asit.pdfover.gui.messages"; //$NON-NLS-1$ - private static HashMap<Locale, ResourceBundle> bundles = new HashMap<Locale, ResourceBundle>(); - - //private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - // .getBundle(BUNDLE_NAME); + private static HashMap<Locale, ResourceBundle> bundles = new HashMap<>(); private static Locale currentLocale = getDefaultLocale(); @@ -71,17 +68,17 @@ public class Messages { private static ResourceBundle getBundle(Locale locale) { if(!bundles.containsKey(locale)) { - log.debug("Loading resource bundle for " + locale); //$NON-NLS-1$ + log.debug("Loading resource bundle for {}", locale); //$NON-NLS-1$ ResourceBundle tmp = null; try { tmp = ResourceBundle.getBundle(BUNDLE_NAME, locale); - log.debug("Received bundle for " + tmp.getLocale()); //$NON-NLS-1$ + log.debug("Received bundle for {}", tmp.getLocale()); //$NON-NLS-1$ } catch(Exception e) { - log.error("NO RESOURCE BUNDLE FOR " + locale.toString(), e); //$NON-NLS-1$ + log.error("NO RESOURCE BUNDLE FOR {} {}", locale, e); //$NON-NLS-1$ tmp = ResourceBundle.getBundle(BUNDLE_NAME); } if(tmp == null) { - log.error("NO RESOURCE BUNDLE FOR " + locale.toString()); //$NON-NLS-1$ + log.error("NO RESOURCE BUNDLE FOR {}", locale); //$NON-NLS-1$ tmp = ResourceBundle.getBundle(BUNDLE_NAME); } bundles.put(locale, tmp); @@ -98,7 +95,6 @@ public class Messages { public static String getString(String key) { try { return getBundle(currentLocale).getString(key); - //return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } @@ -113,7 +109,6 @@ public class Messages { public static String getString(String key, Locale locale) { try { return getBundle(locale).getString(key); - //return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } |