Configuration childConfig = childConfigs[i];
if (!isChild(childConfig)) {
continue childLoop;
}
ProcessingNodeBuilder builder = this.treeBuilder.createNodeBuilder(childConfig);
if (builder instanceof HandleErrorsNodeBuilder) {
// Error handler : check type
HandleErrorsNode handler = (HandleErrorsNode)builder.buildNode(childConfig);
int type = handler.getStatusCode();
if ( (type == 404 && error404Handler != null) ||
(type == 500 && error500Handler != null) ) {
String msg = "Duplicate handle-errors at " + handler.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
if (type == 404) {
error404Handler = handler;
} else if (type == 500) {
error500Handler = handler;
} else {
String msg = "Unkown handle-errors type (" + type + ") at " + handler.getLocation();
getLogger().error(msg);
throw new ConfigurationException(msg);
}
} else {
// Regular builder
children.add(builder.buildNode(childConfig));
}
}
node.setChildren(toNodeArray(children));
node.set404Handler(error404Handler);