From c4a23c2f4d96e0be99afb653043c24432cef4a12 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Wed, 19 May 2021 16:01:52 +0200 Subject: [PATCH] fix: preserving the old identifier among the originalIds in the doiboost construction process, trying to avoid UnsupportedOperationException while adding elements to the originalIds --- .../java/eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala index 8a16cd9097..3f6a26c46c 100644 --- a/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala +++ b/dhp-workflows/dhp-doiboost/src/main/java/eu/dnetlib/doiboost/crossref/Crossref2Oaf.scala @@ -17,6 +17,8 @@ import scala.collection.mutable import scala.util.matching.Regex import eu.dnetlib.dhp.schema.scholexplorer.OafUtils +import java.util + case class CrossrefDT(doi: String, json:String, timestamp: Long) {} case class mappingAffiliation(name: String) {} @@ -96,7 +98,8 @@ case object Crossref2Oaf { val alternativeIds = for (JString(ids) <- json \ "alternative-id") yield ids val tmp = clinicalTrialNumbers ::: alternativeIds ::: List(doi) - result.setOriginalId(tmp.filter(id => id != null).asJava) + val originalIds = new util.ArrayList(tmp.filter(id => id != null).asJava) + result.setOriginalId(originalIds) // Add DataInfo result.setDataInfo(generateDataInfo()) @@ -212,7 +215,7 @@ case object Crossref2Oaf { } result.setId(newId) - if (result.getId== null) + if (result.getId == null) null else result