svn commit: r1126379 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

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

svn commit: r1126379 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

jleroux@apache.org
Author: jleroux
Date: Mon May 23 08:33:42 2011
New Revision: 1126379

URL: http://svn.apache.org/viewvc?rev=1126379&view=rev
Log:
A patch from Philippe Mouawad "UtilCache#getPropertyParam should test property existence instead of rely on MissingResourceException" https://issues.apache.org/jira/browse/OFBIZ-4290

UtilCache#getPropertyParam should call res.containsKey instead of relying on catching MissingResourceException, which will reduce number of Exceptions created so CPU.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=1126379&r1=1126378&r2=1126379&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Mon May 23 08:33:42 2011
@@ -190,9 +190,12 @@ public class UtilCache<K, V> implements
     public static String getPropertyParam(ResourceBundle res, String[] propNames, String parameter) {
         try {
             for (String propName: propNames) {
-                try {
-                    return res.getString(propName + '.' + parameter);
-                } catch (MissingResourceException e) {}
+             if(res.containsKey(propName+ '.' + parameter))
+             {
+                try {
+                    return res.getString(propName + '.' + parameter);
+                } catch (MissingResourceException e) {}
+             }
             }
             // don't need this, just return null
             //if (value == null) {