TaskletStep not marked as FAILED when FlatFileItemWriter fails to append footer [BATCH-1697] #1880
The FlatFileItemWriter writes the footer when the ItemStream is closed.
However, for an TaskletStep the StepExecution is written to the JobRepository before the ItemStream is closed.
This means that any IOException from the FlatFileFooterCallback leaves the StepExecution marked as complete.
Dave suggests implementing the header/footer functionality via the StepExecutionListener interface in the forum post; this would mean that any exception would mark the Step as failed.
Reference URL: http://forum.springsource.org/showthread.php?p=345767
Michael Bannister commented
Dave, in the forum discussion, you suggest that
But StaxEventItemWriter uses its close() method to write closing XML tags; if that fails, the resultant file is invalid, so we really want the Step to be marked as failed...
Dave Syer commented
I'm pretty sure this is a duplicate (maybe BATCH-1864). The comment I made is still true and so it's really a bug that the file writers use close() to call user-provided callbacks. THere was nothing we could do in 2.1.* but maybe in 2.2 we can modify some contracts or add a new one or something.