Improve debug statements
This commit is contained in:
parent
a0e7d70fd3
commit
96336cfbfd
2 changed files with 9 additions and 6 deletions
|
@ -39,8 +39,9 @@ public class I18nBundle {
|
|||
public I18nBundle(String bundleName, ResourceBundle resources) {
|
||||
this(bundleName, resources, MESSAGE_KEY_NOT_FOUND);
|
||||
}
|
||||
|
||||
private I18nBundle(String bundleName, ResourceBundle resources, String notFoundMessage) {
|
||||
|
||||
private I18nBundle(String bundleName, ResourceBundle resources,
|
||||
String notFoundMessage) {
|
||||
if (bundleName == null) {
|
||||
throw new IllegalArgumentException("bundleName may not be null");
|
||||
}
|
||||
|
@ -49,20 +50,22 @@ public class I18nBundle {
|
|||
}
|
||||
if (resources == null) {
|
||||
throw new NullPointerException("resources may not be null.");
|
||||
}if (notFoundMessage == null) {
|
||||
}
|
||||
if (notFoundMessage == null) {
|
||||
throw new NullPointerException("notFoundMessage may not be null.");
|
||||
}
|
||||
this.bundleName = bundleName;
|
||||
this.resources = resources;
|
||||
this.notFoundMessage = notFoundMessage;
|
||||
}
|
||||
|
||||
|
||||
public String text(String key, Object... parameters) {
|
||||
log.debug("Asking for '" + key + "' from bundle '" + bundleName + "'");
|
||||
|
||||
String textString;
|
||||
if (resources.containsKey(key)) {
|
||||
textString = resources.getString(key);
|
||||
log.debug("In '" + bundleName + "', " + key + "='" + textString
|
||||
+ "')");
|
||||
return formatString(textString, parameters);
|
||||
} else {
|
||||
String message = MessageFormat.format(notFoundMessage, bundleName,
|
||||
|
|
|
@ -60,7 +60,7 @@ public class VitroResourceBundle extends ResourceBundle {
|
|||
return new VitroResourceBundle(bundleName, ctx, appI18nPath,
|
||||
themeI18nPath, control);
|
||||
} catch (FileNotFoundException e) {
|
||||
log.debug(e);
|
||||
log.info(e.getMessage());
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
log.warn(e, e);
|
||||
|
|
Loading…
Add table
Reference in a new issue