You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by es...@apache.org on 2006/09/25 23:47:37 UTC
svn commit: r449829 -
/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/util/StringManager.java
Author: esm
Date: Mon Sep 25 14:47:36 2006
New Revision: 449829
URL: http://svn.apache.org/viewvc?view=rev&rev=449829
Log:
[PLUTO-239]: Adding the package name that the resource bundle belongs to when a key cannot be found. Also logs the message at the WARN level.
Modified:
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/util/StringManager.java
Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/util/StringManager.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/util/StringManager.java?view=diff&rev=449829&r1=449828&r2=449829
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/util/StringManager.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/util/StringManager.java Mon Sep 25 14:47:36 2006
@@ -52,6 +52,11 @@
*/
private ResourceBundle bundle;
+
+ /**
+ * The package this StringManager belongs to.
+ */
+ private String packageName = null;
/**
* Creates a new StringManager for a given package. This is a private method
@@ -64,6 +69,7 @@
if(LOG.isDebugEnabled()) {
LOG.debug("String Manager Created for package: "+packageName);
}
+ this.packageName = packageName;
String bundleName = packageName + ".LocalStrings";
try {
bundle = ResourceBundle.getBundle(bundleName);
@@ -116,7 +122,15 @@
try {
str = bundle.getString(key);
} catch (MissingResourceException mre) {
- str = "Cannot find message associated with key '" + key + "'";
+ String name = null;
+ if (packageName == null) {
+ name = "unknown";
+ } else {
+ name = packageName;
+ }
+ str = "Cannot find message in the ResourceBundle associated with key '" + key + "' " +
+ "(package " + name + ")";
+ LOG.warn(str, mre);
}
return str;