RESOLVED - BATCH-414: consistent handling of empty input by ItemReaders

renamed listener + reused NoWorkFoundException
This commit is contained in:
robokaso
2008-06-30 08:16:52 +00:00
parent b95f14075e
commit a35ad43fe7
3 changed files with 9 additions and 12 deletions

View File

@@ -18,6 +18,7 @@ package org.springframework.batch.core.step;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.item.NoWorkFoundException;
import org.springframework.batch.repeat.ExitStatus;
/**
@@ -25,19 +26,13 @@ import org.springframework.batch.repeat.ExitStatus;
*
* @author Robert Kasanicky
*/
public class NoItemsProcessedDetector extends StepExecutionListenerSupport {
public class NoWorkFoundListener extends StepExecutionListenerSupport {
public ExitStatus afterStep(StepExecution stepExecution) {
if (stepExecution.getItemCount().intValue() == 0) {
throw new NoItemsProcessedException("Step has not processed any items");
throw new NoWorkFoundException("Step has not processed any items");
}
return stepExecution.getExitStatus();
}
private static class NoItemsProcessedException extends RuntimeException {
public NoItemsProcessedException(String message) {
super(message);
}
}
}