Author: jleroux
Date: Mon May 23 08:33:42 2011
New Revision: 1126379
URL:
http://svn.apache.org/viewvc?rev=1126379&view=revLog:
A patch from Philippe Mouawad "UtilCache#getPropertyParam should test property existence instead of rely on MissingResourceException"
https://issues.apache.org/jira/browse/OFBIZ-4290UtilCache#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) {