From 3f53088ab841b362ef023739260f0e52c213dee3 Mon Sep 17 00:00:00 2001 From: dhgarrette Date: Sat, 7 Mar 2009 01:44:10 +0000 Subject: [PATCH] BATCH-1125: Updated documentation to reflect the way the NoWorkFoundStepExecutionListener works. --- src/site/docbook/reference/common-patterns.xml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/site/docbook/reference/common-patterns.xml b/src/site/docbook/reference/common-patterns.xml index 85cbf234a..6478bad18 100644 --- a/src/site/docbook/reference/common-patterns.xml +++ b/src/site/docbook/reference/common-patterns.xml @@ -493,12 +493,11 @@ public class NoWorkFoundStepExecutionListener extends StepExecutionListenerSupport { - public ExitStatus afterStep(StepExecution stepExecution) { - if (stepExecution.getReadCount() == 0) { - throw new NoWorkFoundException("Step has not processed any items"); - } - return stepExecution.getExitStatus(); + public ExitStatus afterStep(StepExecution stepExecution) { + if (stepExecution.getReadCount() == 0) { + return ExitStatus.FAILED; } + return null; } @@ -506,7 +505,9 @@ The above StepExecutionListener inspects the readCount property of the StepExecution during the 'afterStep' phase to determine if no items were read. If that is the case, - an exception is thrown, causing the Step to - fail. + an exit code of FAILED is returned, indicating that the + Step should fail. Otherwise, null is returned, + which will not affect the status of the + Step.