Author: lektran
Date: Mon Nov 9 23:01:34 2009
New Revision: 834274
URL:
http://svn.apache.org/viewvc?rev=834274&view=revLog:
Instead of parsing a default string of "0.00" into a BigDecimal just assign BigDecimal.ZERO
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=834274&r1=834273&r2=834274&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Mon Nov 9 23:01:34 2009
@@ -400,7 +400,7 @@
}
// get the selected amount
- String selectedAmountStr = "0.00";
+ String selectedAmountStr = null;
if (paramMap.containsKey("ADD_AMOUNT")) {
selectedAmountStr = (String) paramMap.remove("ADD_AMOUNT");
} else if (paramMap.containsKey("add_amount")) {
@@ -409,13 +409,15 @@
// parse the amount
BigDecimal amount = null;
- if (selectedAmountStr != null && selectedAmountStr.length() > 0) {
+ if (UtilValidate.isNotEmpty(selectedAmountStr)) {
try {
amount = new BigDecimal(nf.parse(selectedAmountStr).doubleValue());
} catch (Exception e) {
Debug.logWarning(e, "Problem parsing amount string: " + selectedAmountStr, module);
amount = null;
}
+ } else {
+ amount = BigDecimal.ZERO;
}
// check for required amount