From 3a7a6ecc32fd443ed1a23b8f9ffaadee285db2c1 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Sun, 26 May 2024 16:48:11 +0200 Subject: [PATCH] [org dedup] avoid NPEs in SparkPrepareOrgRels --- .../java/eu/dnetlib/dhp/oa/dedup/SparkPrepareOrgRels.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/SparkPrepareOrgRels.java b/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/SparkPrepareOrgRels.java index 4fea61c18..83ec7e522 100644 --- a/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/SparkPrepareOrgRels.java +++ b/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/SparkPrepareOrgRels.java @@ -249,7 +249,9 @@ public class SparkPrepareOrgRels extends AbstractSparkAction { .map( (MapFunction, Tuple2>, OrgSimRel>) r -> { OrgSimRel orgSimRel = r._1()._2(); - orgSimRel.setLocal_id(r._2()._2().getOriginalId().get(0)); + orgSimRel + .setLocal_id( + Optional.ofNullable(r._2()._2().getOriginalId()).map(oid -> oid.get(0)).orElse(null)); return orgSimRel; }, Encoders.bean(OrgSimRel.class));