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:47:16 UTC

svn commit: r1558159 - in /ofbiz/branches/release13.07: ./ applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

Author: jacopoc
Date: Tue Jan 14 18:47:15 2014
New Revision: 1558159

URL: http://svn.apache.org/r1558159
Log:
Applied fix from trunk for revision: 1558145 
===

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/branches/release13.07/   (props changed)
    ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java

Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1558145

Modified: ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1558159&r1=1558158&r2=1558159&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Tue Jan 14 18:47:15 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);
             }
         }