Skip to content

Commit

Permalink
fix email source npe (#7145)
Browse files Browse the repository at this point in the history
  • Loading branch information
auumgn authored Nov 25, 2024
1 parent ed7cf7f commit 53586d0
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,14 @@ public static boolean isTheSameForPermissionChecking(Source activeSource, Source
*/
public Source convertEmailSourceToOrcidValidator(Source source) {
source.setSourceOrcid(null);
source.getSourceName().setContent(ORCID_EMAIL_VALIDATOR_CLIENT_NAME);
SourceName sourceName = source.getSourceName();
if (sourceName != null) {
sourceName.setContent(ORCID_EMAIL_VALIDATOR_CLIENT_NAME);
} else {
sourceName = new SourceName();
sourceName.setContent(ORCID_EMAIL_VALIDATOR_CLIENT_NAME);
source.setSourceName(sourceName);
}
SourceClientId sourceClientId = new SourceClientId(ORCID_EMAIL_VALIDATOR_CLIENT_ID);
sourceClientId.setPath(ORCID_EMAIL_VALIDATOR_CLIENT_ID);
sourceClientId.setHost(orcidUrlManager.getBaseHost());
Expand All @@ -258,7 +265,14 @@ public Source convertEmailSourceToOrcidValidator(Source source) {
*/
public org.orcid.jaxb.model.common_v2.Source convertEmailSourceToOrcidValidator(org.orcid.jaxb.model.common_v2.Source source) {
source.setSourceOrcid(null);
source.getSourceName().setContent(ORCID_EMAIL_VALIDATOR_CLIENT_NAME);
org.orcid.jaxb.model.common_v2.SourceName sourceName = source.getSourceName();
if (sourceName != null) {
sourceName.setContent(ORCID_EMAIL_VALIDATOR_CLIENT_NAME);
} else {
sourceName = new org.orcid.jaxb.model.common_v2.SourceName();
sourceName.setContent(ORCID_EMAIL_VALIDATOR_CLIENT_NAME);
source.setSourceName(sourceName);
}
org.orcid.jaxb.model.common_v2.SourceClientId sourceClientId = new org.orcid.jaxb.model.common_v2.SourceClientId(ORCID_EMAIL_VALIDATOR_CLIENT_ID);
sourceClientId.setPath(ORCID_EMAIL_VALIDATOR_CLIENT_ID);
sourceClientId.setHost(orcidUrlManager.getBaseHost());
Expand Down

0 comments on commit 53586d0

Please sign in to comment.