Skip to content

Commit

Permalink
reverse logic in datacite legacy creator, add null check
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Jan 12, 2024
1 parent 1a58684 commit 4293183
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ private void loadProviders() {
case "DataCite":
String mdsUrl = JvmSettings.LEGACY_DATACITE_MDS_API_URL.lookup(String.class);
String restUrl = JvmSettings.LEGACY_DATACITE_REST_API_URL.lookup(String.class);
String dcUsername = JvmSettings.LEGACY_DATACITE_USERNAME.lookup(String.class);
String dcPassword = JvmSettings.LEGACY_DATACITE_PASSWORD.lookup(String.class);
if (mdsUrl == null || restUrl == null || dcUsername == null || dcPassword == null) {
//Defaults for testing where no account is set up
String dcUsername = JvmSettings.LEGACY_DATACITE_USERNAME.lookup(String.class,"");
String dcPassword = JvmSettings.LEGACY_DATACITE_PASSWORD.lookup(String.class,"");
if (mdsUrl != null && restUrl != null && dcUsername != null && dcPassword != null) {
legacy = new DataCiteDOIProvider("legacy", "legacy", authority, shoulder,
identifierGenerationStyle, dataFilePidFormat, "", "", mdsUrl, restUrl, dcUsername,
dcPassword);
Expand All @@ -166,8 +167,10 @@ private void loadProviders() {
identifierGenerationStyle, dataFilePidFormat, "", "");
break;
}
legacy.setPidProviderServiceBean(this);
PidUtil.addToProviderList(legacy);
if (legacy != null) {
legacy.setPidProviderServiceBean(this);
PidUtil.addToProviderList(legacy);
}
} else {
logger.warning("Legacy PID provider settings found - ignored since a provider for the same protocol, authority, shoulder has been registered");
}
Expand Down

0 comments on commit 4293183

Please sign in to comment.