Skip to content

Commit

Permalink
prevent create time from being set if DataCite is down #5093
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed May 28, 2020
1 parent 85fd5be commit 45cfc94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,6 @@ public String reserveIdentifier(String identifier, Map<String, String> metadata,
retString = client.postMetadata(xmlMetadata);
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(DOIDataCiteRegisterService.class.getName()).log(Level.SEVERE, null, ex);
} catch (RuntimeException ex) {
/**
* We're catching this runtime exception because we want the
* dataset to be created even if DataCite is down and we can't
* reserve the DOI.
*/
String msg = "Unable to reserve DOI from DataCite: " + ex.getLocalizedMessage();
logger.severe(msg);
retString = msg;
}
}
return retString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,13 @@ protected void registerExternalIdentifier(Dataset theDataset, CommandContext ctx
}
}
// Invariant: Dataset identifier does not exist in the remote registry
globalIdServiceBean.createIdentifier(theDataset);
// FIXME: Only set the create time if createIdentifier succeeded.
theDataset.setGlobalIdCreateTime(getTimestamp());
theDataset.setIdentifierRegistered(true);
try {
globalIdServiceBean.createIdentifier(theDataset);
theDataset.setGlobalIdCreateTime(getTimestamp());
theDataset.setIdentifierRegistered(true);
} catch (Throwable ex) {
logger.warning("Problem running createIdentifier: " + ex);
}

} catch (Throwable e) {
throw new CommandException(BundleUtil.getStringFromBundle("dataset.publish.error", globalIdServiceBean.getProviderInformation()), this);
Expand Down

0 comments on commit 45cfc94

Please sign in to comment.