I'm using Super CSV for validating a csv file.
I'm getting the row number as listReader.getRowNumber()
but is there a way by which i can get the column number in which there is a validation mistake?
I'm using Super CSV for validating a csv file.
I'm getting the row number as listReader.getRowNumber()
but is there a way by which i can get the column number in which there is a validation mistake?
Copyright © 2021 Jogjafile Inc.
You sure can. The SuperCsvException thrown by Super CSV has a
getContext()
method, which returns the CsvContext when the exception was thrown (you'll need a try/catch around the call toread()
).This contains lots of useful information, including:
In addition, you can also call the getUntokenizedRow() method of the CsvReader to get the raw untokenized row of CSV.
For example
Update:
After looking at the code you added, it looks like you want to capture the validation exceptions, not just know the column number. If so, you should take a look at this question.