You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Deepak Dixit (JIRA)" <ji...@apache.org> on 2018/04/26 04:12:00 UTC

[jira] [Commented] (OFBIZ-10369) ConfigXMLReader - Events are not executed in the order defined

    [ https://issues.apache.org/jira/browse/OFBIZ-10369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16453472#comment-16453472 ] 

Deepak Dixit commented on OFBIZ-10369:
--------------------------------------

Thanks [~vikasmayur],

I agree, I reported this some where (I think on dev list or commit), not sure where :) 
Thanks to Nicolas for coping this to OFBIZ-6298

> 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
>            Priority: Major
>             Fix For: 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)