warn rather than fail if a CSV row is 'the wrong size'
@@ -219,6 +219,11 @@ public class CsvReader {
// Add the rows
while ((nextLine = reader.readNext()) != null) {
+ if (nextLine.length != columnIndexes.length) {
+ System.err.println("Warning: Invalid CSV file. Row "
+ + rowNumber
+ + " is not the expected size. Continuing.");
+ } else {
// for each column that we're including (not skipping)
int cellIndex = 0;
for (int columnIndex : columnIndexes) {
@@ -232,6 +237,7 @@ public class CsvReader {
}
rowNumber++;
}
+ }
return table;
}
}
