This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 45f6a3e247 Improved: Incorrect comparison of Bigdecimals in 
ShoppingCart (OFBIZ-13318)
45f6a3e247 is described below

commit 45f6a3e2477dbeef995785ab35b1de888e0d6834
Author: Jacques Le Roux <[email protected]>
AuthorDate: Fri Nov 28 09:11:10 2025 +0100

    Improved: Incorrect comparison of Bigdecimals in ShoppingCart (OFBIZ-13318)
    
    ShoppingCart::ensureItemsQuantity line 948
    Bigdecimal are compared with !=
    It means memory addresses are compared - was it intentional?
    
    jleroux: actually ShoppingCart::ensureItemsQuantity is quite old (pre 
Apache,
    so before 2006) and not used at all. So this simply removes it. No backport
    needed, simple cleaning.
    
    Thanks: Dmitriy Kryukov
---
 .../java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java | 10 ----------
 1 file changed, 10 deletions(-)

diff --git 
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
 
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
index ba3b297844..39f33d3a0a 100644
--- 
a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
+++ 
b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
@@ -941,16 +941,6 @@ public class ShoppingCart implements 
Iterable<ShoppingCartItem>, Serializable {
         return productList;
     }
 
-    /** Ensure item total quantity */
-    public void ensureItemsQuantity(List<ShoppingCartItem> cartItems, 
LocalDispatcher dispatcher, BigDecimal quantity)
-            throws CartItemModifyException {
-        for (ShoppingCartItem item : cartItems) {
-            if (item.getQuantity() != quantity) {
-                item.setQuantity(quantity, dispatcher, this);
-            }
-        }
-    }
-
     /** Ensure item total quantity */
     public BigDecimal ensureItemsTotalQuantity(List<ShoppingCartItem> 
cartItems, LocalDispatcher dispatcher, BigDecimal quantity)
             throws CartItemModifyException {

Reply via email to