svn commit: r1763085 - /ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1763085 - /ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java

jleroux@apache.org
Author: jleroux
Date: Sun Oct  2 17:12:37 2016
New Revision: 1763085

URL: http://svn.apache.org/viewvc?rev=1763085&view=rev
Log:
Fixes: Can't find resource for bundle
(OFBIZ-8336)

When going for example to EditProductContent (Product --> Content)
the following error message appears:
2016-09-27 20:02:40,822 |http-nio-8444-exec-7 |UtilProperties |I| null
java.util.MissingResourceException: Can't find resource for bundle
org.apache.ofbiz.base.util.UtilProperties$UtilResourceBundle,
key FieldDescription.sequenceNum

jleroux: this has not been handled right from start and in several changes
later. Rather than throwing an exception in UtilProperties.getMessage() it's
better to check if the bundle contains the key and else to log info


Thanks: Ingo Wolfmayr for report and Rohit Koushal for research

Modified:
    ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java

Modified: ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java?rev=1763085&r1=1763084&r2=1763085&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java Sun Oct  2 17:12:37 2016
@@ -589,10 +589,11 @@ public final class UtilProperties implem
         if (bundle == null) return name;
 
         String value = null;
-        try {
+        if (bundle.containsKey(name)) {
             value = bundle.getString(name);
-        } catch (Exception e) {
-            Debug.logInfo(e, module);
+        } else {
+            Debug.logInfo(name + " misses in " + resource + " for locale " + locale, module);
+            return name;
         }
         return value == null ? name : value.trim();
     }