From 1a431e6f8bff2f1118443f5491def26c0d095969 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Tue, 23 Jul 2024 10:19:35 +0200 Subject: [PATCH] [Fix kbss-cvut/record-manager-ui#194] Fix excel export, filter out null elements from input to getBroaderPath to avoid NullPointerException --- .../java/cz/cvut/kbss/study/service/ExcelRecordConverter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/cz/cvut/kbss/study/service/ExcelRecordConverter.java b/src/main/java/cz/cvut/kbss/study/service/ExcelRecordConverter.java index bc62f0db..c2e654c9 100644 --- a/src/main/java/cz/cvut/kbss/study/service/ExcelRecordConverter.java +++ b/src/main/java/cz/cvut/kbss/study/service/ExcelRecordConverter.java @@ -43,7 +43,9 @@ public InputStream convert(List rawRecords){ private List findExportRecordsData(List rawRecords){ Map translatorMap = new HashMap<>(); - List paths = codeListValuesDao.getBroaderPath(rawRecords.stream().map(r -> r.getAc_comp()).collect(Collectors.toSet())); + List paths = codeListValuesDao.getBroaderPath(rawRecords.stream().map(r -> r.getAc_comp()) + .filter(u -> u != null) + .collect(Collectors.toSet())); Set uris = rawRecords.stream().flatMap(r -> Stream.of( r.getClassificationOfOccurrence(), r.getConsequence(), r.getFailureAscertainmentCircumstances(), r.getFailureCause(), r.getAc_comp(), r.getFhaEvent(), r.getMission(), r.getRepair(),