Skip to content

Commit 0833f45

Browse files
committed
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
1 parent c4e120b commit 0833f45

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/main/java/org/apache/commons/csv/CSVParser.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ public CSVParser(String input, CSVFormat format) throws IOException{
110110

111111
/**
112112
* Parses the CSV input according to the given format and returns the content
113-
* as an array of records (whereas records are arrays of single values).
113+
* as an array of {@link CSVRecord} entries.
114114
* <p/>
115115
* The returned content starts at the current parse-position in the stream.
116116
*
117-
* @return matrix of records x values ('null' when end of file)
117+
* @return list of {@link CSVRecord} entries, may be empty
118118
* @throws IOException on parse error or input read-failure
119119
*/
120120
public List<CSVRecord> getRecords() throws IOException {
@@ -123,11 +123,7 @@ public List<CSVRecord> getRecords() throws IOException {
123123
while ((rec = getRecord()) != null) {
124124
records.add(rec);
125125
}
126-
127-
if (!records.isEmpty()) {
128-
return records;
129-
}
130-
return null;
126+
return records;
131127
}
132128

133129
/**

0 commit comments

Comments
 (0)