Skip to content

Commit

Permalink
Skip empty lines in CSV file
Browse files Browse the repository at this point in the history
  • Loading branch information
BartChris committed Mar 22, 2024
1 parent 83b1b9f commit 7c36fb7
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ public List<CsvRecord> parseLines(List<String> lines, String separator) {
List<CsvRecord> records = new LinkedList<>();
for (String line : lines) {
List<CsvCell> cells = new LinkedList<>();
for (String value : line.split(separator, -1)) {
cells.add(new CsvCell(value));
if (!Objects.isNull(line) && !line.isBlank()) {
for (String value : line.split(separator, -1)) {
cells.add(new CsvCell(value));
}
records.add(new CsvRecord(cells));
}
records.add(new CsvRecord(cells));
}
return records;
}
Expand Down

0 comments on commit 7c36fb7

Please sign in to comment.