ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Malin (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (OFBIZ-10369) ConfigXMLReader - Events are not executed in the order defined
Date Fri, 27 Apr 2018 07:42:00 GMT

     [ https://issues.apache.org/jira/browse/OFBIZ-10369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Nicolas Malin closed OFBIZ-10369.
---------------------------------
       Resolution: Fixed
    Fix Version/s: Upcoming Branch
                   16.11.05
                   17.12.01

Hello, I commited this correction at revision:
 * trunk 1830303
 * 17.12 1830305
 * 16.11 1830304

Thanks Vikas for this issue

> ConfigXMLReader - Events are not executed in the order defined
> --------------------------------------------------------------
>
>                 Key: OFBIZ-10369
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10369
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ALL APPLICATIONS
>    Affects Versions: Release Branch 16.11
>            Reporter: Vikas Mayur
>            Assignee: Nicolas Malin
>            Priority: Major
>             Fix For: 17.12.01, 16.11.05, Upcoming Branch
>
>
> 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,
> {code}
>     <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>
> {code}
> 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.
> {code}
> 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>();
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message