From ec87149cb3f6f3208210b1d6f72523e6d7a65d49 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Mon, 19 Sep 2022 14:06:52 +0200 Subject: [PATCH] [Patch Hosted By] added fix to avoi NPE error when datasource official name is not provided. Removing datasources if no officialname has been provided --- .../hostedbymap/SparkProduceHostedByMap.scala | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/oa/graph/hostedbymap/SparkProduceHostedByMap.scala b/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/oa/graph/hostedbymap/SparkProduceHostedByMap.scala index 2b89573f4b..781228f79b 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/oa/graph/hostedbymap/SparkProduceHostedByMap.scala +++ b/dhp-workflows/dhp-graph-mapper/src/main/scala/eu/dnetlib/dhp/oa/graph/hostedbymap/SparkProduceHostedByMap.scala @@ -113,27 +113,15 @@ object SparkProduceHostedByMap { } def oaToHostedbyItemType(dats: Datasource): HostedByItemType = { - if (dats.getJournal != null) { - - if(dats.getOfficialname != null) { - return getHostedByItemType( - dats.getId, - dats.getOfficialname.getValue, - dats.getJournal.getIssnPrinted, - dats.getJournal.getIssnOnline, - dats.getJournal.getIssnLinking, - false - ) - } + if (dats.getJournal != null && dats.getOfficialname != null) { return getHostedByItemType( dats.getId, - "", + dats.getOfficialname.getValue, dats.getJournal.getIssnPrinted, dats.getJournal.getIssnOnline, dats.getJournal.getIssnLinking, false ) - } HostedByItemType("", "", "", "", "", false) }