spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

A failure in ItemStream.close does not fail the step

Open spring-projects-issues opened this issue 13 years ago • 9 comments

Valentin Ozanne opened BATCH-1864 and commented

Hi all,

I am developing batchs with Spring Batch for about a year and I would like to discuss about a possible evolution in close() handling of a stream.

What I could see :

  • Writers like FlatFileItemWriter uses close() method to provide FooterCallback support.
  • When an exception occurred during close() operation, the error is only logged and the step is marked as COMPLETED. It's ever not possible to catch exception inside a stepListeners because close() method is called after listeners. I personally consider this as a bug but I would like to

What I propose : Inside the AbstractStep.execute()

  • Moving close execution before listeners execution
  • Adding ExitStatus handling inside catch bloc of close() execution.

Could you give me a feedback on this proposition? If feedbacks are ok I may try a pull request on this.


Affects: 2.1.8

1 votes, 3 watchers

spring-projects-issues avatar May 27 '12 09:05 spring-projects-issues