BATCH-1073: added check for <listeners> element on <step ref=/>

This commit is contained in:
dhgarrette
2009-02-11 17:41:42 +00:00
parent 474ca20378
commit 14e7c6d01d

View File

@@ -60,6 +60,9 @@ public class InlineStepParser extends AbstractStepParser {
@SuppressWarnings("unchecked")
List<Element> listOfTaskElements = (List<Element>) DomUtils.getChildElementsByTagName(element, "tasklet");
@SuppressWarnings("unchecked")
List<Element> listOfListenersElements = (List<Element>) DomUtils.getChildElementsByTagName(element, "listeners");
if (StringUtils.hasText(stepRef)) {
if (StringUtils.hasText(taskletRef)) {
parserContext.getReaderContext().error("The 'tasklet' attribute can't be combined with the 'ref=\""+ stepRef +"\"' attribute specification for <" + element.getNodeName() + ">", element);
@@ -68,6 +71,9 @@ public class InlineStepParser extends AbstractStepParser {
parserContext.getReaderContext().error("The <" + listOfTaskElements.get(0).getNodeName() +
"> element can't be combined with the 'ref=\""+ stepRef +"\"' attribute specification for <" + element.getNodeName() + ">", element);
}
if (listOfListenersElements.size() > 0) {
parserContext.getReaderContext().error("The 'listeners' element can't be combined with the 'ref=\""+ stepRef +"\"' attribute specification for <" + element.getNodeName() + ">", element);
}
BeanDefinitionBuilder stepBuilder =
BeanDefinitionBuilder.genericBeanDefinition("org.springframework.batch.core.configuration.xml.DelegatingStep");
stepBuilder.addConstructorArgValue(stepId);