Hi Scott,

I continue on this, I have created a Jira 
https://issues.apache.org/jira/browse/OFBIZ-3200

I have replaced all new BigDecimal("0.00") by BigDecimal.ZERO in 
OFBIZ-3200.patch + some changes copied on this commit.

But I'd like to have your opinion on that. There are still these cases. I will handle the POS ones, could you take care of the others or at least guide me

PayPalServices.java (3 matches)
127: encoder.add("L_SHIPPINGOPTIONAMOUNT0", "0.00");
338: encoder.add("SHIPPINGAMT", "0.00");
339: encoder.add("TAXAMT", "0.00");
ValueLinkApi.java
673: return "0.00";

POS
Operator.java
104: String total = "0.00";
Receipt.java (2 matches)
480: UtilFormatOut.formatPrice(trans.getTotalDue().negate()) : "0.00"), 
priceLength[type], false, ' '));
482: UtilFormatOut.formatPrice(trans.GetTotalDiscount()) : "0.00"), 
priceLength[type], false, ' '));

Thanks

Jacques


Author: lektran
Date: Mon Nov  9 23:01:34 2009
New Revision: 834274

URL: http://svn.apache.org/viewvc?rev=834274&view=rev
Log:
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




Reply via email to