You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2021/07/21 14:45:00 UTC
[jira] [Resolved] (CSV-265) CSV comments break
CSVRecord#getCharacterPosition
[ https://issues.apache.org/jira/browse/CSV-265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory resolved CSV-265.
---------------------------------
Fix Version/s: 1.9.0
Resolution: Fixed
> CSV comments break CSVRecord#getCharacterPosition
> -------------------------------------------------
>
> Key: CSV-265
> URL: https://issues.apache.org/jira/browse/CSV-265
> Project: Commons CSV
> Issue Type: Bug
> Components: Parser
> Affects Versions: 1.8
> Reporter: Tyler King
> Priority: Major
> Fix For: 1.9.0
>
> Time Spent: 3h
> Remaining Estimate: 0h
>
> The CSVRecord#getCharacterPosition method returns an incorrect value after the CSVParser has encountered a comment in the CSV file.
> Example:
>
> {code:java}
> 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);{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)