BATCH-531: Moved item count increment from Step to ItemHandler so that the last call to ItemReader#read() doesn't inadvertently increment the count. Also added a test case.

This commit is contained in:
lucasward
2008-04-09 03:38:27 +00:00
parent 3877476e15
commit 3edc30eec6
3 changed files with 18 additions and 1 deletions

View File

@@ -320,7 +320,6 @@ public class ItemOrientedStep extends AbstractStep {
// check for interruption before each item as well
interruptionPolicy.checkInterrupted(execution);
ExitStatus exitStatus = itemHandler.handle(contribution);
contribution.incrementItemCount();
// check for interruption after each item as well
interruptionPolicy.checkInterrupted(execution);
return exitStatus;

View File

@@ -89,6 +89,7 @@ public class SimpleItemHandler implements ItemHandler {
* @param contribution current context
*/
protected void write(Object item, StepContribution contribution) throws Exception {
contribution.incrementItemCount();
doWrite(item);
}