More information about failed DOI registrations.

This commit is contained in:
Mark H. Wood
2024-09-17 08:47:54 -04:00
parent fc16a5f39f
commit b8f4ab0eb3
2 changed files with 23 additions and 2 deletions

View File

@@ -577,7 +577,8 @@ public class DOIOrganiser {
} }
} catch (IdentifierException ex) { } catch (IdentifierException ex) {
if (!(ex instanceof DOIIdentifierException)) { if (!(ex instanceof DOIIdentifierException)) {
LOG.error("It wasn't possible to register the identifier online. ", ex); LOG.error("Registering DOI {} for object {}: the registrar returned an error.",
doiRow.getDoi(), dso.getID(), ex);
} }
DOIIdentifierException doiIdentifierException = (DOIIdentifierException) ex; DOIIdentifierException doiIdentifierException = (DOIIdentifierException) ex;

View File

@@ -461,6 +461,10 @@ public class DataCiteConnector
log.warn("While reserving the DOI {}, we got a http status code " log.warn("While reserving the DOI {}, we got a http status code "
+ "{} and the message \"{}\".", + "{} and the message \"{}\".",
doi, Integer.toString(resp.statusCode), resp.getContent()); doi, Integer.toString(resp.statusCode), resp.getContent());
Format format = Format.getCompactFormat();
format.setEncoding("UTF-8");
XMLOutputter xout = new XMLOutputter(format);
log.info("We send the following XML:\n{}", xout.outputString(root));
throw new DOIIdentifierException("Unable to parse an answer from " throw new DOIIdentifierException("Unable to parse an answer from "
+ "DataCite API. Please have a look into DSpace logs.", + "DataCite API. Please have a look into DSpace logs.",
DOIIdentifierException.BAD_ANSWER); DOIIdentifierException.BAD_ANSWER);
@@ -632,6 +636,14 @@ public class DataCiteConnector
return sendHttpRequest(httpget, doi); return sendHttpRequest(httpget, doi);
} }
/**
* Send a DataCite metadata document to the registrar.
*
* @param doi identify the object.
* @param metadataRoot describe the object. The root element of the document.
* @return the registrar's response.
* @throws DOIIdentifierException passed through.
*/
protected DataCiteResponse sendMetadataPostRequest(String doi, Element metadataRoot) protected DataCiteResponse sendMetadataPostRequest(String doi, Element metadataRoot)
throws DOIIdentifierException { throws DOIIdentifierException {
Format format = Format.getCompactFormat(); Format format = Format.getCompactFormat();
@@ -640,6 +652,14 @@ public class DataCiteConnector
return sendMetadataPostRequest(doi, xout.outputString(new Document(metadataRoot))); return sendMetadataPostRequest(doi, xout.outputString(new Document(metadataRoot)));
} }
/**
* Send a DataCite metadata document to the registrar.
*
* @param doi identify the object.
* @param metadata describe the object.
* @return the registrar's response.
* @throws DOIIdentifierException passed through.
*/
protected DataCiteResponse sendMetadataPostRequest(String doi, String metadata) protected DataCiteResponse sendMetadataPostRequest(String doi, String metadata)
throws DOIIdentifierException { throws DOIIdentifierException {
// post mds/metadata/ // post mds/metadata/
@@ -687,7 +707,7 @@ public class DataCiteConnector
* properties such as request URI and method type. * properties such as request URI and method type.
* @param doi DOI string to operate on * @param doi DOI string to operate on
* @return response from DataCite * @return response from DataCite
* @throws DOIIdentifierException if DOI error * @throws DOIIdentifierException if registrar returns an error.
*/ */
protected DataCiteResponse sendHttpRequest(HttpUriRequest req, String doi) protected DataCiteResponse sendHttpRequest(HttpUriRequest req, String doi)
throws DOIIdentifierException { throws DOIIdentifierException {