A slightly modified patch from Leon for "ConcurrentModificationException when cancelling an order" https://issues.apache.org/jira/browse/OFBIZ-5194

Leon:
Thanks for resolve this bug. But it introduce a small flaw: all cancelled items is filtered out from order item list.

The filter condition before this patch is : ("Y".equals(orderItem.get("isPromo")) && "ITEM_CANCELLED".equals(orderItem.get("statusId"))); – means filter out the item that is promo "AND" cancelled.
That of patch is : ! ((item.isPromo == null || item.isPromo == 'N') && !(item.statusId.equals('ITEM_CANCELLED'))) – means filter outer the item that is promo "OR" cancelled.

Theses two is not equivalent. After this patch, all cancelled items are filter out, no matter it's promo or not.


jleroux:

What we had before the change:
 get cancelled promo items
 remove them from the list of items
So we got all items but cancelled promo items

What we have now:
Get non-promo items AND non-cancelled items (or as said Scott "get all non-promo items that aren't cancelled")

What you suggest:
Get non-promo items OR non-cancelled items (if re-phrase what you suggest: get all non-promo items and add to them all the non-cancelled ones, so including the non-cancelled promo ones)

Your sentence "After this patch, all cancelled items are filter out, no matter it's promo or not." is almost right. Because we not only miss the cancelled non-promo but also the promo not cancelled

To re-prhase myself: Currently we miss the promo items which are not cancelled and the non-promo items which are cancelled

Pfew... the exclusive reasoning is here quite easier than the inclusive one!

I removed the useless parentheses around the cancelled proposition

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1524361 13f79535-47bb-0310-9956-ffa450edef68