diff options
author | David Festal <david.festal@serli.com> | 2011-06-16 15:02:53 +0200 |
---|---|---|
committer | David Festal <david.festal@serli.com> | 2011-07-04 22:52:55 +0200 |
commit | ab9e61f1c71a9c55b9eef925a49581957be19116 (patch) | |
tree | 0c537b716116df171cd33168ef166ae2004aacb6 /plugins/sonar-core-plugin/src | |
parent | d7c0d144d27ac2b7cefb60b0de0c6e82eff28441 (diff) | |
download | sonarqube-ab9e61f1c71a9c55b9eef925a49581957be19116.tar.gz sonarqube-ab9e61f1c71a9c55b9eef925a49581957be19116.zip |
New API for Ruby and Java side
Diffstat (limited to 'plugins/sonar-core-plugin/src')
-rw-r--r-- | plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java index 8438b706622..c66ae9c134a 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java @@ -138,11 +138,14 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension } } - public String message(final Locale locale, final String key, final String defaultText, final Object... objects) { + public String message(final Locale locale, final String key, final String defaultText, final Object... objects) + { String result = defaultText; try { String bundleBaseName = keys.get(key); if (bundleBaseName == null) { + if (result == null) + throw new MissingResourceException("UNKNOWN KEY : Key '" + key + "' not found in any bundle.", bundleBaseName, key); LOG.warn("UNKNOWN KEY : Key '{}' not found in any bundle. Default value '{}' is returned.", key, defaultText); unknownKeys.put(key, defaultText); } else { @@ -151,18 +154,24 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension String value = bundle.getString(key); if ("".equals(value)) { + if (result == null) + throw new MissingResourceException("VOID KEY : Key '" + key + "' (from bundle '" + bundleBaseName + "') returns a void value.", bundleBaseName, key); LOG.warn("VOID KEY : Key '{}' (from bundle '{}') returns a void value. Default value '{}' is returned.", new Object[]{key, bundleBaseName, defaultText}); } else { result = value; } } catch (MissingResourceException e) { + if (result == null) + throw e; LOG.warn("BUNDLE NOT LOADED : Failed loading bundle {} from classloader {}. Default value '{}' is returned.", new Object[]{ bundleBaseName, bundleClassLoader, defaultText}); } } } catch (Exception e) { LOG.error("Exception when retrieving I18n string.", e); + if (result == null) + throw new SonarException("Exception when retrieving I18n string.", e); } if (objects.length > 0) { |