mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merge pull request #10486 from atmire/issue-10484_fix-invalid-cast-in-DOIOrganiser
Fix invalid cast in DOIOrganiser exception handling
This commit is contained in:
@@ -448,28 +448,28 @@ public class DOIOrganiser {
|
|||||||
+ " is successfully registered.");
|
+ " is successfully registered.");
|
||||||
}
|
}
|
||||||
} catch (IdentifierException ex) {
|
} catch (IdentifierException ex) {
|
||||||
|
String message;
|
||||||
if (!(ex instanceof DOIIdentifierException)) {
|
if (!(ex instanceof DOIIdentifierException)) {
|
||||||
LOG.error("It wasn't possible to register this identifier: "
|
message = "It wasn't possible to register this identifier: "
|
||||||
+ DOI.SCHEME + doiRow.getDoi()
|
+ DOI.SCHEME + doiRow.getDoi()
|
||||||
+ " online. ", ex);
|
+ " online. ";
|
||||||
|
} else {
|
||||||
|
DOIIdentifierException doiIdentifierException = (DOIIdentifierException) ex;
|
||||||
|
message = "It wasn't possible to register this identifier : "
|
||||||
|
+ DOI.SCHEME + doiRow.getDoi()
|
||||||
|
+ " online. Exceptions code: "
|
||||||
|
+ DOIIdentifierException.codeToString(doiIdentifierException.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
DOIIdentifierException doiIdentifierException = (DOIIdentifierException) ex;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sendAlertMail("Register", dso,
|
sendAlertMail("Register", dso,
|
||||||
DOI.SCHEME + doiRow.getDoi(),
|
DOI.SCHEME + doiRow.getDoi(),
|
||||||
doiIdentifierException.codeToString(doiIdentifierException
|
message);
|
||||||
.getCode()));
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
LOG.error("Couldn't send mail", ioe);
|
LOG.error("Couldn't send mail", ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.error("It wasn't possible to register this identifier : "
|
LOG.error(message, ex);
|
||||||
+ DOI.SCHEME + doiRow.getDoi()
|
|
||||||
+ " online. Exceptions code: "
|
|
||||||
+ doiIdentifierException
|
|
||||||
.codeToString(doiIdentifierException.getCode()), ex);
|
|
||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
System.err.println("It wasn't possible to register this identifier: "
|
System.err.println("It wasn't possible to register this identifier: "
|
||||||
@@ -541,27 +541,27 @@ public class DOIOrganiser {
|
|||||||
System.out.println("This identifier : " + DOI.SCHEME + doiRow.getDoi() + " is successfully reserved.");
|
System.out.println("This identifier : " + DOI.SCHEME + doiRow.getDoi() + " is successfully reserved.");
|
||||||
}
|
}
|
||||||
} catch (IdentifierException ex) {
|
} catch (IdentifierException ex) {
|
||||||
|
String message;
|
||||||
if (!(ex instanceof DOIIdentifierException)) {
|
if (!(ex instanceof DOIIdentifierException)) {
|
||||||
LOG.error("It wasn't possible to register this identifier : "
|
message = "It wasn't possible to register this identifier : "
|
||||||
+ DOI.SCHEME + doiRow.getDoi()
|
+ DOI.SCHEME + doiRow.getDoi()
|
||||||
+ " online. ", ex);
|
+ " online. ";
|
||||||
|
} else {
|
||||||
|
DOIIdentifierException doiIdentifierException = (DOIIdentifierException) ex;
|
||||||
|
message = "It wasn't possible to reserve the identifier online. "
|
||||||
|
+ " Exceptions code: "
|
||||||
|
+ DOIIdentifierException.codeToString(doiIdentifierException.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
DOIIdentifierException doiIdentifierException = (DOIIdentifierException) ex;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sendAlertMail("Reserve", dso,
|
sendAlertMail("Reserve", dso,
|
||||||
DOI.SCHEME + doiRow.getDoi(),
|
DOI.SCHEME + doiRow.getDoi(),
|
||||||
DOIIdentifierException.codeToString(
|
message);
|
||||||
doiIdentifierException.getCode()));
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
LOG.error("Couldn't send mail", ioe);
|
LOG.error("Couldn't send mail", ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.error("It wasn't possible to reserve the identifier online. "
|
LOG.error(message, ex);
|
||||||
+ " Exceptions code: "
|
|
||||||
+ DOIIdentifierException
|
|
||||||
.codeToString(doiIdentifierException.getCode()), ex);
|
|
||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
System.err.println("It wasn't possible to reserve this identifier: " + DOI.SCHEME + doiRow.getDoi());
|
System.err.println("It wasn't possible to reserve this identifier: " + DOI.SCHEME + doiRow.getDoi());
|
||||||
@@ -606,27 +606,27 @@ public class DOIOrganiser {
|
|||||||
+ doiRow.getDoi() + ".");
|
+ doiRow.getDoi() + ".");
|
||||||
}
|
}
|
||||||
} catch (IdentifierException ex) {
|
} catch (IdentifierException ex) {
|
||||||
|
String message;
|
||||||
if (!(ex instanceof DOIIdentifierException)) {
|
if (!(ex instanceof DOIIdentifierException)) {
|
||||||
LOG.error("Registering DOI {} for object {}: the registrar returned an error.",
|
message = String.format("Registering DOI %s for object %s: the registrar returned an error.",
|
||||||
doiRow.getDoi(), dso.getID(), ex);
|
doiRow.getDoi(), dso.getID());
|
||||||
|
} else {
|
||||||
|
DOIIdentifierException doiIdentifierException = (DOIIdentifierException) ex;
|
||||||
|
message = "It wasn't possible to update this identifier: "
|
||||||
|
+ DOI.SCHEME + doiRow.getDoi()
|
||||||
|
+ " Exceptions code: "
|
||||||
|
+ DOIIdentifierException.codeToString(doiIdentifierException.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
DOIIdentifierException doiIdentifierException = (DOIIdentifierException) ex;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sendAlertMail("Update", dso,
|
sendAlertMail("Update", dso,
|
||||||
DOI.SCHEME + doiRow.getDoi(),
|
DOI.SCHEME + doiRow.getDoi(),
|
||||||
doiIdentifierException.codeToString(doiIdentifierException
|
message);
|
||||||
.getCode()));
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
LOG.error("Couldn't send mail", ioe);
|
LOG.error("Couldn't send mail", ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.error("It wasn't possible to update this identifier: "
|
LOG.error(message, ex);
|
||||||
+ DOI.SCHEME + doiRow.getDoi()
|
|
||||||
+ " Exceptions code: "
|
|
||||||
+ doiIdentifierException
|
|
||||||
.codeToString(doiIdentifierException.getCode()), ex);
|
|
||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
System.err.println("It wasn't possible to update this identifier: " + DOI.SCHEME + doiRow.getDoi());
|
System.err.println("It wasn't possible to update this identifier: " + DOI.SCHEME + doiRow.getDoi());
|
||||||
@@ -830,4 +830,4 @@ public class DOIOrganiser {
|
|||||||
this.quiet = true;
|
this.quiet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user