You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/05/22 23:29:02 UTC

svn commit: r1485432 - /ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

Author: jleroux
Date: Wed May 22 21:29:02 2013
New Revision: 1485432

URL: http://svn.apache.org/r1485432
Log:
A sligthly modified patch from Jonatan Soto for "ConcurrentModificationException when cancelling an order" https://issues.apache.org/jira/browse/OFBIZ-5194

After the order gets cancelled, there is a loop in OrderView.groovy@122 that removes promotional order line items retrieved from the OrderReadHelper class when cancelled. This is what makes the ConcurrentModificationException to be thrown.

For further details, check out the following thread at the dev mailing list: http://ofbiz.markmail.org/message/vmm65cmbf5hkmqm6?page=2

jleroux: I simply put a comment and removed the useless temporary orderItemListFiltered variable

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1485432&r1=1485431&r2=1485432&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Wed May 22 21:29:02 2013
@@ -117,15 +117,11 @@ if (orderHeader) {
     grandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments);
     context.grandTotal = grandTotal;
 
-    canceledPromoOrderItem = [:];
     orderItemList = orderReadHelper.getOrderItems();
-    orderItemList.each { orderItem ->
-        if("Y".equals(orderItem.get("isPromo")) && "ITEM_CANCELLED".equals(orderItem.get("statusId"))) {
-            canceledPromoOrderItem = orderItem;
-        }
-        orderItemList.remove(canceledPromoOrderItem);
+    // Retrieve all non-promo items that aren't cancelled
+    context.orderItemList = orderReadHelper.getOrderItems().findAll { item ->
+        (item.isPromo == null || item.isPromo == 'N')  && !(item.statusId.equals('ITEM_CANCELLED'))
     }
-    context.orderItemList = orderItemList;
 
     shippingAddress = orderReadHelper.getShippingAddress();
     context.shippingAddress = shippingAddress;