OAI error message
This commit is contained in:
parent
1a5884a4d2
commit
b4d9e7315e
|
@ -139,6 +139,14 @@ public class CollectorService {
|
|||
final String xml = HttpFetcher.download(call);
|
||||
final Document doc = DocumentHelper.parseText(xml);
|
||||
|
||||
final Node errorNode = doc.selectSingleNode("/*[local-name()='OAI-PMH']/*[local-name()='error']");
|
||||
if (errorNode != null) {
|
||||
final String errorCode = errorNode.valueOf("@code");
|
||||
final String errorMessage = errorNode.getText();
|
||||
call.setNumberOfRecords(0);
|
||||
throw new IllegalArgumentException(errorCode + " - " + errorMessage);
|
||||
}
|
||||
|
||||
final List<Node> records = doc.selectNodes("//*[local-name()='ListRecords']/*[local-name()='record']");
|
||||
call.setNumberOfRecords(records.size());
|
||||
|
||||
|
@ -155,7 +163,7 @@ public class CollectorService {
|
|||
final String rtoken = doc.valueOf("//*[local-name()='resumptionToken']").trim();
|
||||
url = SimpleUtils.oaiNextUrl(baseUrl, rtoken);
|
||||
} else {
|
||||
url = "";
|
||||
url = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
I am writing to inform you that your request to collect metadata from the provided URL has been completed successfully.<br />
|
||||
<b>Request ID:</b> <span th:text="${info.id}"></span><br />
|
||||
<b>URL:</b> <a th:href="${info.oaiBaseUrl}" th:text="${info.oaiBaseUrl}"></a><br />
|
||||
<b>Collected Records:</b> <span th:text="${info.total}"></span><br />
|
||||
</p>
|
||||
|
||||
<p th:if="${info.publicUrl}">
|
||||
|
|
Loading…
Reference in New Issue