From 7c36fb78c47374f343779eee35ce5e1e8d1a269c Mon Sep 17 00:00:00 2001 From: BartChris Date: Fri, 22 Mar 2024 14:21:15 +0100 Subject: [PATCH] Skip empty lines in CSV file --- .../production/services/data/MassImportService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/MassImportService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/MassImportService.java index 522fed00b9c..8675c9e000b 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/MassImportService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/MassImportService.java @@ -100,10 +100,12 @@ public List parseLines(List lines, String separator) { List records = new LinkedList<>(); for (String line : lines) { List 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; }