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:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user