I was wondering if there was a way to have Spring Batch do the following:

Say I have 3 steps A, B and C and I have a file clean up task on Step D.

I process step A, and start on B and I get a totally unexpected exception -- say a null pointer exception or class cast exception -- something totally unexpected.

I want to completely stop task B (or A or C) and go to my file clean up task on Step D and then complete my job.

Thanks