Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add null check when fetching emails #7123

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,14 @@ public ModelAndView confirmDeactivateOrcidAccount(HttpServletRequest request, Ht
}
org.orcid.pojo.ajaxForm.Emails emails = org.orcid.pojo.ajaxForm.Emails.valueOf(v2Emails, emailDomains);
// Old emails are missing the source name and id -- assign the user as the source
for (org.orcid.pojo.ajaxForm.Email email: emails.getEmails()) {
if (email.getSource() == null && email.getSourceName() == null) {
String orcid = getCurrentUserOrcid();
String displayName = getPersonDetails(orcid, true).getDisplayName();
email.setSource(orcid);
email.setSourceName(displayName);
if (emails.getEmails() != null) {
for (org.orcid.pojo.ajaxForm.Email email : emails.getEmails()) {
if (email.getSource() == null && email.getSourceName() == null) {
String orcid = getCurrentUserOrcid();
String displayName = getPersonDetails(orcid, true).getDisplayName();
email.setSource(orcid);
email.setSourceName(displayName);
}
}
}
return emails;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,15 @@ PublicRecord getRecord(String orcid) {

org.orcid.pojo.ajaxForm.Emails emails = org.orcid.pojo.ajaxForm.Emails.valueOf(filteredEmails, emailDomains);
// Old emails are missing the source name and id -- assign the user as the source
for (org.orcid.pojo.ajaxForm.Email email: emails.getEmails()) {
if (email.getSource() == null && email.getSourceName() == null) {
email.setSource(orcid);
email.setSourceName(publicRecord.getDisplayName());
if (emails.getEmails() != null) {
for (org.orcid.pojo.ajaxForm.Email email: emails.getEmails()) {
if (email.getSource() == null && email.getSourceName() == null) {
email.setSource(orcid);
email.setSourceName(publicRecord.getDisplayName());
}
}
}

publicRecord.setEmails(emails);

// Fill external identifiers
Expand Down
Loading