diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractStepParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractStepParser.java index 9704cbc7b..e008b4f6b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractStepParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/AbstractStepParser.java @@ -71,8 +71,8 @@ public abstract class AbstractStepParser { * @param stepElement The <step/> element * @param parserContext * @param jobRepositoryRef The name of the bean defining the JobRepository. - * Use 'null' if the job-repository is specified on the - * <tasklet/> element; this method will look it up. + * Use 'null' if the job-repository is specified on the + * <tasklet/> element; this method will look it up. */ protected AbstractBeanDefinition parseStep(Element stepElement, ParserContext parserContext, String jobRepositoryRef) { @@ -108,24 +108,18 @@ public abstract class AbstractStepParser { String taskletRef = taskletElement.getAttribute(TASKLET_REF_ATTR); @SuppressWarnings("unchecked") - List chunkTaskletElements = (List) DomUtils.getChildElementsByTagName(taskletElement, - CHUNK_ELE); + List chunkElements = (List) DomUtils.getChildElementsByTagName(taskletElement, CHUNK_ELE); if (StringUtils.hasText(taskletRef)) { - if (chunkTaskletElements.size() > 0) { + if (chunkElements.size() > 0) { parserContext.getReaderContext().error( - "The <" + CHUNK_ELE + "/> element can't be combined with the '" + TASKLET_REF_ATTR - + "=\"" + taskletRef + "\"' attribute specification for <" - + taskletElement.getNodeName() + "/>", taskletElement); + "The <" + CHUNK_ELE + "/> element can't be combined with the '" + TASKLET_REF_ATTR + "=\"" + + taskletRef + "\"' attribute specification for <" + taskletElement.getNodeName() + + "/>", taskletElement); } parseTaskletRef(taskletRef, bd.getPropertyValues()); } - else if (chunkTaskletElements.size() == 1) { - chunkElementParser.parse(chunkTaskletElements.get(0), bd, parserContext, stepUnderspecified); - } - else if (chunkTaskletElements.size() > 1) { - parserContext.getReaderContext().error( - "The '<" + CHUNK_ELE + "/>' element may not appear more than once in a single <" - + taskletElement.getNodeName() + "/>.", taskletElement); + else if (chunkElements.size() == 1) { + chunkElementParser.parse(chunkElements.get(0), bd, parserContext, stepUnderspecified); } else if (!stepUnderspecified) { parserContext.getReaderContext().error( @@ -204,11 +198,6 @@ public abstract class AbstractStepParser { propertyValues.addPropertyValue("transactionTimeout", timeout); } } - else if (txAttrElements.size() > 1) { - parserContext.getReaderContext().error( - "The <" + TX_ATTRIBUTES_ELE + "/> element may not appear more than once in a single <" - + stepElement.getNodeName() + "/>.", stepElement); - } } @SuppressWarnings("unchecked") @@ -267,11 +256,6 @@ public abstract class AbstractStepParser { propertyValues.addPropertyValue("listeners", listenerBeans); parserContext.popAndRegisterContainingComponent(); } - else if (listenersElements.size() > 1) { - parserContext.getReaderContext().error( - "The <" + LISTENERS_ELE + "/> element may not appear more than once in a single <" - + stepElement.getNodeName() + "/>.", stepElement); - } } } diff --git a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd index 8fcfbeb31..0bc9435f1 100644 --- a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd +++ b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd @@ -264,10 +264,10 @@ - - - - + + + + - - + +