diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java index f793a3c8c..b2602ec87 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java @@ -66,9 +66,6 @@ public class SplitParser { String idAttribute = element.getAttribute("id"); - @SuppressWarnings("unchecked") - List flowElements = (List) DomUtils.getChildElementsByTagName(element, "flow"); - BeanDefinitionBuilder stateBuilder = BeanDefinitionBuilder.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.SplitState"); @@ -78,6 +75,13 @@ public class SplitParser { stateBuilder.addPropertyValue("taskExecutor", taskExecutorRef); } + @SuppressWarnings("unchecked") + List flowElements = (List) DomUtils.getChildElementsByTagName(element, "flow"); + + if (flowElements.size() < 2) { + parserContext.getReaderContext().error("A must contain at least two 'flow' elements.", element); + } + Collection flows = new ArrayList(); int i = 0; for (Element nextElement : flowElements) { 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 0b53e4cbd..fee9b975b 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 @@ -160,100 +160,98 @@ - - - - - - Defines a stage in job processing backed by a - Step. The id attribute must be specified. The - step requires either a tasklet definition, a - tasklet reference, a reference to a step defined - elsewhere, or a reference to a (possibly - abstract) parent step. - - - - - - - + + + + + Defines a stage in job processing backed by a + Step. The id attribute must be specified. The + step requires either a tasklet definition, a + tasklet reference, a reference to a step defined + elsewhere, or a reference to a (possibly + abstract) parent step. + + + + + + + + + + A reference to a step defined elsewhere. + + + + + + + + + + + + + + + Declares job should split here into two or more subflows. + + + + + + + - A reference to a step defined elsewhere. + A subflow within a job, having the same format as a job, but without a separate identity. - - - - - - - - - - - - - Declares job should split here into two or more subflows. - - - - - - - - - - A subflow within a job, having the same format as a job, but without a separate identity. - - - - - - - - - - - - - - - - - - - - - - - - Declares job should query a decider to determine where execution should go next. - - - - - - - - - The decider is a reference to a JobExecutionDecider that can produce a status to base - the next transition on. - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + Declares job should query a decider to determine where execution should go next. + + + + + + + + + The decider is a reference to a JobExecutionDecider that can produce a status to base + the next transition on. + + + + + + + + + + + @@ -287,14 +285,12 @@ - - - - - - + + + + - + @@ -592,104 +588,101 @@ - - - - - - Defines a transition from this step to the - next one depending on the value of the exit - status. - - - - - - A pattern to match against the exit status - code. Use * and ? as wildcard characters. When a - step finishes the most - specific match will be chosen to select the next step. Hint: - always include a default - transition with on="*". - - - - - The name of the step to go to next. Must resolve to one of the other steps in this job. - - - - - - - - - Declares job should be stop at this point and provides pointer where execution should continue when - the job is restarted. - - - - - - A pattern to match against the exit status code. Use * and ? as wildcard characters. - When a step finishes the most specific match will be chosen to select the next step. - - - - The name of the step to start on when the stopped job is restarted. - Must resolve to one of the other steps in this job. - - - - - - - - Declares job should end at this point, without the possibility of restart. - BatchStatus will be COMPLETED. ExitStatus is configurable. - - - - - - A pattern to match against the exit status code. Use * and ? as wildcard characters. - When a step finishes the most specific match will be chosen to select the next step. - - - - - The exit code value to end on, defaults to COMPLETED. - - - - - - - - Declares job should fail at this point. BatchStatus will be FAILED. ExitStatus is configurable. - - - - - - A pattern to match against the exit status code. Use * and ? as wildcard characters. - When a step finishes the most specific match will be chosen to select the next step. - - - - - The exit code value to end on, defaults to FAILED. - - - - - - + + + + + Defines a transition from this step to the + next one depending on the value of the exit + status. + + + + + + A pattern to match against the exit status + code. Use * and ? as wildcard characters. When a + step finishes the most + specific match will be chosen to select the next step. Hint: + always include a default + transition with on="*". + + + + + The name of the step to go to next. Must resolve to one of the other steps in this job. + + + + + + + + + Declares job should be stop at this point and provides pointer where execution should continue when + the job is restarted. + + + + + + A pattern to match against the exit status code. Use * and ? as wildcard characters. + When a step finishes the most specific match will be chosen to select the next step. + + + + The name of the step to start on when the stopped job is restarted. + Must resolve to one of the other steps in this job. + + + + + + + + Declares job should end at this point, without the possibility of restart. + BatchStatus will be COMPLETED. ExitStatus is configurable. + + + + + + A pattern to match against the exit status code. Use * and ? as wildcard characters. + When a step finishes the most specific match will be chosen to select the next step. + + + + + The exit code value to end on, defaults to COMPLETED. + + + + + + + + Declares job should fail at this point. BatchStatus will be FAILED. ExitStatus is configurable. + + + + + + A pattern to match against the exit status code. Use * and ? as wildcard characters. + When a step finishes the most specific match will be chosen to select the next step. + + + + + The exit code value to end on, defaults to FAILED. + + + + + - + - + + + - -