Author: doogie
Date: Thu Jan 28 20:09:00 2010
New Revision: 904247
URL:
http://svn.apache.org/viewvc?rev=904247&view=revLog:
Add a new getPropertyNumber variant that takes a url.
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=904247&r1=904246&r2=904247&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 Thu Jan 28 20:09:00 2010
@@ -258,14 +258,21 @@
return value;
}
- public static double getPropertyNumber(URL url, String name) {
+ public static double getPropertyNumber(URL url, String name, double defaultValue) {
String str = getPropertyValue(url, name);
- double strValue = 0.00000;
+ if (str == null) {
+ return defaultValue;
+ }
try {
- strValue = Double.parseDouble(str);
- } catch (NumberFormatException nfe) {}
- return strValue;
+ return Double.parseDouble(str);
+ } catch (NumberFormatException nfe) {
+ return defaultValue;
+ }
+ }
+
+ public static double getPropertyNumber(URL url, String name) {
+ return getPropertyNumber(url, name, 0.00000);
}
/** Returns the value of the specified property name from the specified resource/properties file