Author: doogie
Date: Wed Jan 27 17:55:13 2010
New Revision: 903766
URL:
http://svn.apache.org/viewvc?rev=903766&view=revLog:
Fix handling of default values in getPropertyNumber.
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=903766&r1=903765&r2=903766&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 Wed Jan 27 17:55:13 2010
@@ -119,22 +119,20 @@
}
public static double getPropertyNumber(String resource, String name, double defaultValue) {
- double value = getPropertyNumber(resource, name);
+ String str = getPropertyValue(resource, name);
+ if (str == null) {
+ return defaultValue;
+ }
- if (value == 0.00000)
+ try {
+ return Double.parseDouble(str);
+ } catch (NumberFormatException nfe) {
return defaultValue;
- else
- return value;
+ }
}
public static double getPropertyNumber(String resource, String name) {
- String str = getPropertyValue(resource, name);
- double strValue = 0.00000;
-
- try {
- strValue = Double.parseDouble(str);
- } catch (NumberFormatException nfe) {}
- return strValue;
+ return getPropertyNumber(resource, name, 0.00000);
}
/** Returns the value of the specified property name from the specified resource/properties file