commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (Commented) (JIRA)" <>
Subject [jira] [Commented] (CSV-57) CSVParser.getRecords() contract is confusing
Date Mon, 12 Mar 2012 19:22:37 GMT


Benedikt Ritter commented on CSV-57:

I'm afraid that making {{getRecord()}} public will cause trouble with the iterator. At least
it should be mentioned in the javadoc, that calling {{getRecord()}} during an iteration will
cause the iterator to skip an element (and in the worst case cause a {{NoSuchElementException}}).
If there is the concept of a header in CSV, why not provide a method that is specific for
this purpose?
> CSVParser.getRecords() contract is confusing
> --------------------------------------------
>                 Key: CSV-57
>                 URL:
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Parser
>            Reporter: Benedikt Ritter
>            Priority: Minor
> {{CSVParser.getRecords()}} has a confusing contract. It will return all records from
the current position instead of all values in the parsed file. This implies that users will
first iterate over the records using the iterator and then call getRecords(). This seems like
an unlikely use case.
> Also, it is not good practice to return {{null}}. So getRecords() should return an empty
array, if no records can be found.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message