Skip to content
Permalink
Browse files

Improved: Rewrite ‘loadHandlerMap’

(OFBIZ-10453)

This retrieves the attribute "class" instead of "className" which was
mistakenly used in revision 1862323.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862343 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jun 30, 2019
1 parent c51b069 commit a71766e92916983afad183cad80019ccd56a173c
@@ -31,6 +31,7 @@
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;

import javax.servlet.ServletContext;

@@ -192,8 +193,8 @@ private static Element loadDocument(URL location) throws WebAppConfigurationExce
private final Map<String, Event> postprocessorEventList = new LinkedHashMap<>();
private final Map<String, Event> afterLoginEventList = new LinkedHashMap<>();
private final Map<String, Event> beforeLogoutEventList = new LinkedHashMap<>();
private Map<String, String> eventHandlerMap = new HashMap<>();
private Map<String, String> viewHandlerMap = new HashMap<>();
private final Map<String, String> eventHandlerMap = new HashMap<>();
private final Map<String, String> viewHandlerMap = new HashMap<>();
private MultivaluedMapContext<String, RequestMap> requestMapMap = new MultivaluedMapContext<>();
private Map<String, ViewMap> viewMapMap = new HashMap<>();

@@ -359,17 +360,11 @@ private void loadGeneralConfig(Element rootElement) {
}

private void loadHandlerMap(Element rootElement) {
for (Element handlerElement : UtilXml.childElementList(rootElement, "handler")) {
String name = handlerElement.getAttribute("name");
String type = handlerElement.getAttribute("type");
String className = handlerElement.getAttribute("class");

if ("view".equals(type)) {
this.viewHandlerMap.put(name, className);
} else {
this.eventHandlerMap.put(name, className);
}
}
Map<Boolean, Map<String, String>> handlers = UtilXml.childElementList(rootElement, "handler").stream()
.collect(Collectors.partitioningBy(el -> "view".equals(el.getAttribute("type")),
Collectors.toMap(el -> el.getAttribute("name"), el -> el.getAttribute("class"))));
viewHandlerMap.putAll(handlers.get(true));
eventHandlerMap.putAll(handlers.get(false));
}

protected void loadIncludes(Element rootElement) {

0 comments on commit a71766e

Please sign in to comment.
You can’t perform that action at this time.