[ 
https://issues.apache.org/jira/browse/CSV-57?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benedikt Ritter updated CSV-57:
-------------------------------

    Attachment: CSV-57.txt

Hi,

I've created a patch, that does some very minor refactoring:

* use for each loop in favor of while loop (just for readability)
* changed implementation to return empty array instead of null
* JUnit test, that makes sure, that an empty array will be returned, if there 
is nothing to parse
* Some JavaDoc adjustments

Regards,
Benedikt
                
> CSVParser.getRecords() contract is confusing
> --------------------------------------------
>
>                 Key: CSV-57
>                 URL: https://issues.apache.org/jira/browse/CSV-57
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Parser
>            Reporter: Benedikt Ritter
>            Priority: Minor
>         Attachments: CSV-57.txt
>
>
> {{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: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to