CSV-87 CSVParser.getRecords() returns null rather than empty List at EOF

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1305692 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-03-27 00:42:22 +00:00
parent c4e120bbf4
commit 0833f45bff

View File

@ -110,11 +110,11 @@ public class CSVParser implements Iterable<CSVRecord> {
/**
* Parses the CSV input according to the given format and returns the content
* as an array of records (whereas records are arrays of single values).
* as an array of {@link CSVRecord} entries.
* <p/>
* The returned content starts at the current parse-position in the stream.
*
* @return matrix of records x values ('null' when end of file)
* @return list of {@link CSVRecord} entries, may be empty
* @throws IOException on parse error or input read-failure
*/
public List<CSVRecord> getRecords() throws IOException {
@ -123,11 +123,7 @@ public class CSVParser implements Iterable<CSVRecord> {
while ((rec = getRecord()) != null) {
records.add(rec);
}
if (!records.isEmpty()) {
return records;
}
return null;
return records;
}
/**