From 67085da3053768f95cfc9d281a931a29d2090846 Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Fri, 16 Apr 2021 11:05:58 +0200 Subject: [PATCH] fixed NPE --- .../src/main/java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala | 4 +++- .../eu/dnetlib/dhp/doiboost/convert_map_to_oaf_params.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala index 05660d461a..0b5edfb194 100644 --- a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala +++ b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/orcid/ORCIDToOAF.scala @@ -76,7 +76,9 @@ object ORCIDToOAF { implicit lazy val formats: DefaultFormats.type = org.json4s.DefaultFormats lazy val json: json4s.JValue = parse(input) - val oid = (json \ "workDetail" \"oid").extract[String] + val oid = (json \ "workDetail" \"oid").extractOrElse[String](null) + if (oid == null) + return List() val doi:List[(String, String)] = for { JObject(extIds) <- json \ "workDetail" \"extIds" JField("type", JString(typeValue)) <- extIds diff --git a/dhp-workflows/dhp-doiboost/src/main/resources/eu/dnetlib/dhp/doiboost/convert_map_to_oaf_params.json b/dhp-workflows/dhp-doiboost/src/main/resources/eu/dnetlib/dhp/doiboost/convert_map_to_oaf_params.json index 8ca7ac89ee..1521035705 100644 --- a/dhp-workflows/dhp-doiboost/src/main/resources/eu/dnetlib/dhp/doiboost/convert_map_to_oaf_params.json +++ b/dhp-workflows/dhp-doiboost/src/main/resources/eu/dnetlib/dhp/doiboost/convert_map_to_oaf_params.json @@ -1,6 +1,6 @@ [ {"paramName":"s", "paramLongName":"sourcePath", "paramDescription": "the path of the Orcid Input file", "paramRequired": true}, - {"paramName":"w", "paramLongName":"workingPath", "paramDescription": "the working path ", "paramRequired": true}, + {"paramName":"w", "paramLongName":"workingPath", "paramDescription": "the working path ", "paramRequired": false}, {"paramName":"t", "paramLongName":"targetPath", "paramDescription": "the working dir path", "paramRequired": true}, {"paramName":"m", "paramLongName":"master", "paramDescription": "the master name", "paramRequired": true}