svn commit: r903197 - /ofbiz/trunk/framework/base/src/org/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: r903197 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java

jleroux@apache.org
Author: jleroux
Date: Tue Jan 26 12:30:02 2010
New Revision: 903197

URL: http://svn.apache.org/viewvc?rev=903197&view=rev
Log:
A patch from Sascha Rodekamp "Extend getPropertyNumber, Default Value" (https://issues.apache.org/jira/browse/OFBIZ-3425) - OFBIZ-3425

Adds a method to have a default value to getPropertyNumber methods, can't hurt and maybe useful in some cases.



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

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=903197&r1=903196&r2=903197&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java Tue Jan 26 12:30:02 2010
@@ -118,6 +118,15 @@
             return value;
     }
 
+    public static double getPropertyNumber(String resource, String name, Double defaultValue) {
+        double value = getPropertyNumber(resource, name);
+         if(value == 0.00000){
+             return defaultValue;
+         }
+
+        return value;
+    }
+
     public static double getPropertyNumber(String resource, String name) {
         String str = getPropertyValue(resource, name);
         double strValue = 0.00000;