Improve debug statements

This commit is contained in:
j2blake 2013-04-23 17:28:46 -04:00
parent a0e7d70fd3
commit 96336cfbfd
2 changed files with 9 additions and 6 deletions

View file

@ -40,7 +40,8 @@ public class I18nBundle {
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,7 +50,8 @@ 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;
@ -58,11 +60,12 @@ public class I18nBundle {
}
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,

View file

@ -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);