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