fixed NPE, removed unused stuff

This commit is contained in:
Claudio Atzori 2022-12-06 12:04:00 +01:00
parent 71b121e9f8
commit 062abfd669
1 changed files with 3 additions and 6 deletions

View File

@ -94,7 +94,6 @@ public class DedupRecordFactory {
BeanUtils.copyProperties(entity, first); BeanUtils.copyProperties(entity, first);
final Collection<String> dates = Lists.newArrayList();
final List<List<Author>> authors = Lists.newArrayList(); final List<List<Author>> authors = Lists.newArrayList();
entityList entityList
@ -103,16 +102,14 @@ public class DedupRecordFactory {
entity.mergeFrom(duplicate); entity.mergeFrom(duplicate);
if (ModelSupport.isSubClass(duplicate, Result.class)) { if (ModelSupport.isSubClass(duplicate, Result.class)) {
Result r1 = (Result) duplicate; Result r1 = (Result) duplicate;
if (r1.getAuthor() != null && StringUtils.isNotBlank(r1.getDateofacceptance().getValue())) Optional
authors.add(r1.getAuthor()); .ofNullable(r1.getAuthor())
if (r1.getDateofacceptance() != null) .ifPresent(a -> authors.add(a));
dates.add(r1.getDateofacceptance().getValue());
} }
}); });
// set authors and date // set authors and date
if (ModelSupport.isSubClass(entity, Result.class)) { if (ModelSupport.isSubClass(entity, Result.class)) {
// ((Result) entity).setDateofacceptance(DatePicker.pick(dates));
((Result) entity).setAuthor(AuthorMerger.merge(authors)); ((Result) entity).setAuthor(AuthorMerger.merge(authors));
} }