Skip to content

Commit e16d074

Browse files
committed
some last touches. #12070
1 parent 87fc45a commit e16d074

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

doc/release-notes/12070-datacite-getmetadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Incremental improvements have been made to the process of registering dataset metadata with DataCite. If your instance is using DataCite, please make sure you have the DataCite REST API url configured, since it is now required.
1+
Incremental improvements have been made to the process of registering dataset metadata with DataCite. If your instance is using DataCite, please make sure you have a valid DataCite REST API url configured, since it is now required.
22

33
The JVM option(s) in question are `dataverse.pid.*.datacite.rest-api-url` if the recommended, new-style pid configuration is used, or `doi.dataciterestapiurlstring` if the legacy settings are in place. In the latter case however, this may be a good occasion to switch to the new configuration setup.
44

src/main/java/edu/harvard/iq/dataverse/pidproviders/doi/datacite/DOIDataCiteRegisterService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public String reRegisterIdentifier(String identifier, Map<String, String> metada
8787
String currentMetadata = null;
8888
boolean hasDifferences = false;
8989
try {
90-
currentMetadata = client.getMetadataViaRestApi(bareIdentifier);
90+
currentMetadata = client.getMetadata(bareIdentifier);
9191
Diff myDiff = DiffBuilder.compare(xmlMetadata).withTest(currentMetadata).ignoreWhitespace().checkForSimilar()
9292
.build();
9393
hasDifferences = myDiff.hasDifferences();

src/main/java/edu/harvard/iq/dataverse/pidproviders/doi/datacite/DataCiteRESTfullClient.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ public String postUrl(String doi, String url) throws IOException {
194194
* @return
195195
*/
196196
public String getMetadata(String doi) {
197+
// Try obtaining the metadata using the new, REST API:
198+
try {
199+
return getMetadataViaRestApi(doi);
200+
} catch (RuntimeException rex) {
201+
logger.warning("Failed to getMetadata via REST API for doi " + doi +", falling back to MDS");
202+
}
203+
197204
HttpGet httpGet = new HttpGet(this.url + "/metadata/" + doi);
198205
httpGet.setHeader("Accept", "application/xml");
199206
try {

0 commit comments

Comments
 (0)