Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Release Branch 16.11
-
None
-
Patch
Description
The events contained in the controller configuration for first-visit, pre-post processor and before-after login are executed in arbitrary order rather than the defined order. This results in unexpected results.
For example,
<after-login> <event name="keepCartUpdated" type="java" path="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="keepCartUpdated"/> <event name="restoreAutoSaveList" type="java" path="org.apache.ofbiz.order.shoppinglist.ShoppingListEvents" invoke="restoreAutoSaveList"/> <event name="saveCartToAutoSaveList" type="java" path="org.apache.ofbiz.order.shoppinglist.ShoppingListEvents" invoke="saveCartToAutoSaveList"/> </after-login>
While debugging I have found that the event 'restoreAutoSaveList' run before 'keepCartUpdated'. I would expect the events to run from top (first) to bottom (last).
I am unable to attach a patch but below are the changes to fix the issue. I have tested the issue on release 16 and it may be an issue in trunk.
Index: framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ConfigXMLReader.java =================================================================== --- framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ConfigXMLReader.java (revision 1830130) +++ framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ConfigXMLReader.java (working copy) @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -182,11 +183,11 @@ private String defaultRequest; private String statusCode; private List<URL> includes = new ArrayList<URL>(); - private Map<String, Event> firstVisitEventList = new HashMap<String, Event>(); - private Map<String, Event> preprocessorEventList = new HashMap<String, Event>(); - private Map<String, Event> postprocessorEventList = new HashMap<String, Event>(); - private Map<String, Event> afterLoginEventList = new HashMap<String, Event>(); - private Map<String, Event> beforeLogoutEventList = new HashMap<String, Event>(); + private Map<String, Event> firstVisitEventList = new LinkedHashMap<String, Event>(); + private Map<String, Event> preprocessorEventList = new LinkedHashMap<String, Event>(); + private Map<String, Event> postprocessorEventList = new LinkedHashMap<String, Event>(); + private Map<String, Event> afterLoginEventList = new LinkedHashMap<String, Event>(); + private Map<String, Event> beforeLogoutEventList = new LinkedHashMap<String, Event>(); private Map<String, String> eventHandlerMap = new HashMap<String, String>(); private Map<String, String> viewHandlerMap = new HashMap<String, String>(); private Map<String, RequestMap> requestMapMap = new HashMap<String, RequestMap>();
Attachments
Issue Links
- is related to
-
OFBIZ-6298 Java collection use optimized
- Open