4

I need to parse an semicolon-separated CSV-File with Spring Batch. Currently I'm using DelimitedLineTokenizer within a DefaultLineMapper.

The Problem ist, that my CSV rows contains line breaks between quotes. Its kinda multi-line description of every row.

Example:

column1;column2;column3;column4
value1;"value2
continuation of value2";column3;column4

This leads into the following error:

org.springframework.batch.item.file.transform.IncorrectTokenCountException: Incorrect number of tokens found in record: expected 4 actual 3

So how to tell that Tokenizer to ignore line-breaks \n within the quote-escaped columns?

Micronax
  • 660
  • 13
  • 25

0 Answers0