Description
The CSVRecord#getCharacterPosition method returns an incorrect value after the CSVParser has encountered a comment in the CSV file.
Example:
String csv = "# Comment\n" + "Headers,Header2\n" + "Value1,Value2\n"; CSVFormat format = CSVFormat.EXCEL.withCommentMarker('#').withFirstRecordAsHeader(); CSVParser parser = new CSVParser(new StringReader(csv), format); long expectedPosition = csv.indexOf("Value1"); long actualPosition = parser.iterator().next().getCharacterPosition(); assertEquals(expectedPosition, actualPosition);