From 062abfd669fbb70ede939ba0e65fa44a59ef49ac Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Tue, 6 Dec 2022 12:04:00 +0100 Subject: [PATCH] fixed NPE, removed unused stuff --- .../java/eu/dnetlib/dhp/oa/dedup/DedupRecordFactory.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/DedupRecordFactory.java b/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/DedupRecordFactory.java index 82bf87cca..7637cde93 100644 --- a/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/DedupRecordFactory.java +++ b/dhp-workflows/dhp-dedup-openaire/src/main/java/eu/dnetlib/dhp/oa/dedup/DedupRecordFactory.java @@ -94,7 +94,6 @@ public class DedupRecordFactory { BeanUtils.copyProperties(entity, first); - final Collection dates = Lists.newArrayList(); final List> authors = Lists.newArrayList(); entityList @@ -103,16 +102,14 @@ public class DedupRecordFactory { entity.mergeFrom(duplicate); if (ModelSupport.isSubClass(duplicate, Result.class)) { Result r1 = (Result) duplicate; - if (r1.getAuthor() != null && StringUtils.isNotBlank(r1.getDateofacceptance().getValue())) - authors.add(r1.getAuthor()); - if (r1.getDateofacceptance() != null) - dates.add(r1.getDateofacceptance().getValue()); + Optional + .ofNullable(r1.getAuthor()) + .ifPresent(a -> authors.add(a)); } }); // set authors and date if (ModelSupport.isSubClass(entity, Result.class)) { - // ((Result) entity).setDateofacceptance(DatePicker.pick(dates)); ((Result) entity).setAuthor(AuthorMerger.merge(authors)); }