I'm using Spring Batch FlatFileItemReader to parse csv files. Every now and then I get an ill-formated line and the application completely crashes with:
Caused by: org.springframework.batch.item.file.transform.IncorrectTokenCountException: Incorrect number of tokens found in record: expected 11 actual 18
Is there any way to tell the FlatFileItemReader to continue (throw exception and continue or ignore and continue) without it completely exiting the application. 
I'm guessing I may need to extend the FlatFileItemReader to make this happen as there does not appear to be any setting for this. Any suggestions on how best to proceed and make this happen?
You can configure SkipLogic for your batch jobs Here's a link to doc
Basically, if you are using Java Config to manage your Batch Job you can do something like this
stepBuilderFactory.get("step1")
                .<Person, Person>chunk(10)
                .reader(reader)
                .writer(writer)
                .processor(processor)
                .faultTolerant()
                .skipLimit(10)
                .skip(RuntimeException.class)
                .listener(skipListener) // if you want to add
                .build();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With