From 289886178269436076a9d61280e81e4f5825c3ea Mon Sep 17 00:00:00 2001 From: trisberg Date: Tue, 27 Jan 2009 04:21:31 +0000 Subject: [PATCH] BATCH-1004: improved error handling and documentation for step element --- .../batch/core/configuration/xml/StepParser.java | 4 ++++ .../batch/core/configuration/xml/spring-batch-2.0.xsd | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java index a382144d0..2ecda7a8f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java @@ -67,6 +67,10 @@ public class StepParser { String stepRef = element.getAttribute("name"); String taskletRef = element.getAttribute("tasklet"); + if (!StringUtils.hasText(stepRef)) { + parserContext.getReaderContext().error("The name attribute can't be empty for <" + element.getNodeName() + ">", element); + } + @SuppressWarnings("unchecked") List processTaskElements = (List) DomUtils.getChildElementsByTagName(element, "tasklet"); if (StringUtils.hasText(taskletRef)) { 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 d2b5059ec..c5a3636d8 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 @@ -117,9 +117,11 @@ Defines a stage in job processing backed by a - Step. The name - attribute has to match the id of a bean definition - for a Step. + Step. + The name attribute must be specified and + can match the id of a bean definition + for a Step. If it does not, then you must provide a + tasklet definition. The next attribute is a synonym for <next on="*" .../> @@ -129,7 +131,8 @@ - The step name is a reference to another bean definition where business logic is specified. + The step name attribute defines the name for the step. It can be used as + a reference to another bean definition where business logic is specified.