From 511c0521e5ae7cf34715f23ca2b14efc78360c9d Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Mon, 12 Apr 2021 17:45:11 +0200 Subject: [PATCH] [dedup] avoiding NPEs handling OpenOrg relations --- .../java/eu/dnetlib/dhp/oa/dedup/AbstractSparkAction.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/AbstractSparkAction.java b/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/AbstractSparkAction.java index e8e67567b..647a1b9c8 100644 --- a/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/AbstractSparkAction.java +++ b/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/AbstractSparkAction.java @@ -6,6 +6,7 @@ import java.io.Serializable; import java.io.StringReader; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; @@ -137,7 +138,8 @@ abstract class AbstractSparkAction implements Serializable { .map( c -> c .stream() - .filter(kv -> kv.getValue().equals(ModelConstants.OPENORGS_NAME)) + .filter(Objects::nonNull) + .filter(kv -> ModelConstants.OPENORGS_NAME.equals(kv.getValue())) .findFirst() .isPresent()) .orElse(false);