Author: jleroux
Date: Wed May 22 21:31:51 2013
New Revision: 1485433

URL: http://svn.apache.org/r1485433
Log:
"Applied fix from trunk for revision: 1485432  " 
------------------------------------------------------------------------
r1485432 | jleroux | 2013-05-22 23:29:02 +0200 (mer., 22 mai 2013) | 7 lines

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/branches/release12.04/   (props changed)
    
ofbiz/branches/release12.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1485432

Modified: 
ofbiz/branches/release12.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1485433&r1=1485432&r2=1485433&view=diff
==============================================================================
--- 
ofbiz/branches/release12.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
 (original)
+++ 
ofbiz/branches/release12.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
 Wed May 22 21:31:51 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;


Reply via email to