[cleaning] avoiding NPEs handling null author PIDs

This commit is contained in:
Claudio Atzori 2021-04-12 17:31:40 +02:00
parent 11b22b2d23
commit 902d05f548
1 changed files with 3 additions and 2 deletions

View File

@ -58,9 +58,9 @@ public class CleaningFunctions {
} }
} }
if (Objects.nonNull(r.getAuthor())) { if (Objects.nonNull(r.getAuthor())) {
r.getAuthor().forEach(a -> { r.getAuthor().stream().filter(Objects::nonNull).forEach(a -> {
if (Objects.nonNull(a.getPid())) { if (Objects.nonNull(a.getPid())) {
a.getPid().forEach(p -> { a.getPid().stream().filter(Objects::nonNull).forEach(p -> {
fixVocabName(p.getQualifier(), ModelConstants.DNET_PID_TYPES); fixVocabName(p.getQualifier(), ModelConstants.DNET_PID_TYPES);
}); });
} }
@ -218,6 +218,7 @@ public class CleaningFunctions {
a a
.getPid() .getPid()
.stream() .stream()
.filter(Objects::nonNull)
.filter(p -> Objects.nonNull(p.getQualifier())) .filter(p -> Objects.nonNull(p.getQualifier()))
.filter(p -> StringUtils.isNotBlank(p.getValue())) .filter(p -> StringUtils.isNotBlank(p.getValue()))
.map(p -> { .map(p -> {