0

I'm unable to store the error getting registered in all the phases (parsing phase, business error, database error, invalid data error) in a csv file

Reason: The csv input row cannot be retrieved as the error method have only exception as parameter and not the actual csv row data. (Ex: parse exception alone has inputString method() and rest of the error handling phase doesn't have the input)

How to get the input row or the row being processed in all the stages of the spring batch job??

I need to create error csv with the following CSV row columns + line number + error message + reason

1 Answer 1

1

If the error occurs during the read, then a FlatFileParseException will be passed to the SkipListener#onSkipInRead. This exception gives you the line number as well as the raw line read from the file.

If you want to intercept errors while processing, ie in SkipListener#onSkipInProcess, then it is up to you to write an exception class that has all details needed for error reporting. The item could be designed to carry the raw line it was read from.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.