From 6f3e1e5cf5d126232ea16f9a42cefcad2ed04dae Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:11:27 +0200 Subject: [PATCH] add null checks to summaries (#7160) * add missing null check to summaries * ?? --------- Co-authored-by: amontenegro --- .../orcid/core/common/manager/impl/SummaryManagerImpl.java | 4 ++-- .../java/org/orcid/persistence/dao/NotificationDaoTest.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/orcid-core/src/main/java/org/orcid/core/common/manager/impl/SummaryManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/common/manager/impl/SummaryManagerImpl.java index 9594550614b..7e2bad43662 100644 --- a/orcid-core/src/main/java/org/orcid/core/common/manager/impl/SummaryManagerImpl.java +++ b/orcid-core/src/main/java/org/orcid/core/common/manager/impl/SummaryManagerImpl.java @@ -283,7 +283,7 @@ public RecordSummaryPojo getRecordSummaryPojo(String orcid) { for (EmailDomain ed : recordSummary.getEmailDomains().getEmailDomains()) { EmailDomainSummary eds = new EmailDomainSummary(); eds.setValue(ed.getValue()); - if (ed.getVerificationDate() != null) { + if (ed.getVerificationDate() != null && ed.getVerificationDate().getValue() != null) { eds.setVerificationDate(ed.getVerificationDate().toString()); } emailDomains.add(eds); @@ -524,7 +524,7 @@ public void generateEmailDomainsSummary(RecordSummary recordSummary, String orci for (ProfileEmailDomainEntity ped : emailDomains) { ed = new EmailDomain(); ed.setValue(ped.getEmailDomain()); - if (!ped.getGeneratedByScript()) { + if (!ped.getGeneratedByScript() && ped.getDateCreated() != null) { VerificationDate verificationDate = new VerificationDate(DateUtils.convertToXMLGregorianCalendar(ped.getDateCreated())); ed.setVerificationDate(verificationDate); } diff --git a/orcid-persistence/src/test/java/org/orcid/persistence/dao/NotificationDaoTest.java b/orcid-persistence/src/test/java/org/orcid/persistence/dao/NotificationDaoTest.java index 57cfb43dc69..9b2b70922ec 100644 --- a/orcid-persistence/src/test/java/org/orcid/persistence/dao/NotificationDaoTest.java +++ b/orcid-persistence/src/test/java/org/orcid/persistence/dao/NotificationDaoTest.java @@ -242,7 +242,6 @@ public void testFindNotificationsToSendLegacy() { for (Long id : ids) { notificationDao.remove(id); } - } private Long createNotification(String orcid, Date sentDate) {