You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/01/14 19:25:13 UTC

svn commit: r1558145 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

Author: jacopoc
Date: Tue Jan 14 18:25:12 2014
New Revision: 1558145

URL: http://svn.apache.org/r1558145
Log:
Fixed bug reported by Adrian Crum and introduced with the promotion engine refactoring that I committed in rev. 1554265: under some conditions an "ArithmeticException: Non-terminating decimal expansion" could be thrown by the new ShoppingCart$ProductPromoUseInfo.getUsageWeight() method due to missing scale and rounding mode; this method computes a "weight" for the "promotion use" that is used to sort promotions to be applied.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1558145&r1=1558144&r2=1558145&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Tue Jan 14 18:25:12 2014
@@ -4415,7 +4415,7 @@ public class ShoppingCart implements Ite
             if (totalAmount.compareTo(BigDecimal.ZERO) == 0) {
                 return BigDecimal.ZERO;
             } else {
-                return getTotalDiscountAmount().negate().divide(totalAmount);
+                return getTotalDiscountAmount().negate().divide(totalAmount, scale, rounding);
             }
         }