Author: lektran
Date: Fri Jun 18 08:23:28 2010 New Revision: 955882 URL: http://svn.apache.org/viewvc?rev=955882&view=rev Log: Controller events (post/preprocessor, first-visit, after-login etc.) without 'name' attributes were not being loaded into the controller properly since the switch to storing them in <String, Event> maps, fixed by deriving a name from the other element attributes when an explicit one isn't provided Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java?rev=955882&r1=955881&r2=955882&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java Fri Jun 18 08:23:28 2010 @@ -32,6 +32,7 @@ import javolution.util.FastList; import javolution.util.FastMap; import javolution.util.FastSet; +import org.apache.commons.lang.RandomStringUtils; import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.FileUtil; @@ -318,7 +319,11 @@ public class ConfigXMLReader { Element firstvisitElement = UtilXml.firstChildElement(rootElement, "firstvisit"); if (firstvisitElement != null) { for (Element eventElement: UtilXml.childElementList(firstvisitElement, "event")) { - this.firstVisitEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.firstVisitEventList.put(eventName, new Event(eventElement)); } } @@ -326,7 +331,11 @@ public class ConfigXMLReader { Element preprocessorElement = UtilXml.firstChildElement(rootElement, "preprocessor"); if (preprocessorElement != null) { for (Element eventElement: UtilXml.childElementList(preprocessorElement, "event")) { - this.preprocessorEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.preprocessorEventList.put(eventName, new Event(eventElement)); } } @@ -334,7 +343,11 @@ public class ConfigXMLReader { Element postprocessorElement = UtilXml.firstChildElement(rootElement, "postprocessor"); if (postprocessorElement != null) { for (Element eventElement: UtilXml.childElementList(postprocessorElement, "event")) { - this.postprocessorEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.postprocessorEventList.put(eventName, new Event(eventElement)); } } @@ -342,7 +355,11 @@ public class ConfigXMLReader { Element afterLoginElement = UtilXml.firstChildElement(rootElement, "after-login"); if (afterLoginElement != null) { for (Element eventElement: UtilXml.childElementList(afterLoginElement, "event")) { - this.afterLoginEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.afterLoginEventList.put(eventName, new Event(eventElement)); } } @@ -350,7 +367,11 @@ public class ConfigXMLReader { Element beforeLogoutElement = UtilXml.firstChildElement(rootElement, "before-logout"); if (beforeLogoutElement != null) { for (Element eventElement: UtilXml.childElementList(beforeLogoutElement, "event")) { - this.beforeLogoutEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.beforeLogoutEventList.put(eventName, new Event(eventElement)); } } } |
Free forum by Nabble | Edit this page |