mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 06:53:09 +00:00
return 400 on arxiv in no record were found
This commit is contained in:
@@ -199,16 +199,20 @@ public class ArXivImportMetadataSourceServiceImpl extends AbstractImportMetadata
|
|||||||
}
|
}
|
||||||
Invocation.Builder invocationBuilder = local.request(MediaType.TEXT_PLAIN_TYPE);
|
Invocation.Builder invocationBuilder = local.request(MediaType.TEXT_PLAIN_TYPE);
|
||||||
Response response = invocationBuilder.get();
|
Response response = invocationBuilder.get();
|
||||||
String responseString = response.readEntity(String.class);
|
if (response.getStatus() == 200) {
|
||||||
OMXMLParserWrapper records = OMXMLBuilderFactory.createOMBuilder(new StringReader(responseString));
|
String responseString = response.readEntity(String.class);
|
||||||
OMElement element = records.getDocumentElement();
|
OMXMLParserWrapper records = OMXMLBuilderFactory.createOMBuilder(new StringReader(responseString));
|
||||||
AXIOMXPath xpath = null;
|
OMElement element = records.getDocumentElement();
|
||||||
try {
|
AXIOMXPath xpath = null;
|
||||||
xpath = new AXIOMXPath("opensearch:totalResults");
|
try {
|
||||||
xpath.addNamespace("opensearch", "http://a9.com/-/spec/opensearch/1.1/");
|
xpath = new AXIOMXPath("opensearch:totalResults");
|
||||||
OMElement count = (OMElement) xpath.selectSingleNode(element);
|
xpath.addNamespace("opensearch", "http://a9.com/-/spec/opensearch/1.1/");
|
||||||
return Integer.parseInt(count.getText());
|
OMElement count = (OMElement) xpath.selectSingleNode(element);
|
||||||
} catch (JaxenException e) {
|
return Integer.parseInt(count.getText());
|
||||||
|
} catch (JaxenException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -253,12 +257,16 @@ public class ArXivImportMetadataSourceServiceImpl extends AbstractImportMetadata
|
|||||||
}
|
}
|
||||||
Invocation.Builder invocationBuilder = local.request(MediaType.TEXT_PLAIN_TYPE);
|
Invocation.Builder invocationBuilder = local.request(MediaType.TEXT_PLAIN_TYPE);
|
||||||
Response response = invocationBuilder.get();
|
Response response = invocationBuilder.get();
|
||||||
String responseString = response.readEntity(String.class);
|
if (response.getStatus() == 200) {
|
||||||
List<OMElement> omElements = splitToRecords(responseString);
|
String responseString = response.readEntity(String.class);
|
||||||
for (OMElement record : omElements) {
|
List<OMElement> omElements = splitToRecords(responseString);
|
||||||
results.add(transformSourceRecords(record));
|
for (OMElement record : omElements) {
|
||||||
|
results.add(transformSourceRecords(record));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,12 +303,16 @@ public class ArXivImportMetadataSourceServiceImpl extends AbstractImportMetadata
|
|||||||
WebTarget local = webTarget.queryParam("id_list", arxivid);
|
WebTarget local = webTarget.queryParam("id_list", arxivid);
|
||||||
Invocation.Builder invocationBuilder = local.request(MediaType.TEXT_PLAIN_TYPE);
|
Invocation.Builder invocationBuilder = local.request(MediaType.TEXT_PLAIN_TYPE);
|
||||||
Response response = invocationBuilder.get();
|
Response response = invocationBuilder.get();
|
||||||
String responseString = response.readEntity(String.class);
|
if (response.getStatus() == 200) {
|
||||||
List<OMElement> omElements = splitToRecords(responseString);
|
String responseString = response.readEntity(String.class);
|
||||||
for (OMElement record : omElements) {
|
List<OMElement> omElements = splitToRecords(responseString);
|
||||||
results.add(transformSourceRecords(record));
|
for (OMElement record : omElements) {
|
||||||
|
results.add(transformSourceRecords(record));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,12 +339,16 @@ public class ArXivImportMetadataSourceServiceImpl extends AbstractImportMetadata
|
|||||||
WebTarget local = webTarget.queryParam("search_query", queryString);
|
WebTarget local = webTarget.queryParam("search_query", queryString);
|
||||||
Invocation.Builder invocationBuilder = local.request(MediaType.TEXT_PLAIN_TYPE);
|
Invocation.Builder invocationBuilder = local.request(MediaType.TEXT_PLAIN_TYPE);
|
||||||
Response response = invocationBuilder.get();
|
Response response = invocationBuilder.get();
|
||||||
String responseString = response.readEntity(String.class);
|
if (response.getStatus() == 200) {
|
||||||
List<OMElement> omElements = splitToRecords(responseString);
|
String responseString = response.readEntity(String.class);
|
||||||
for (OMElement record : omElements) {
|
List<OMElement> omElements = splitToRecords(responseString);
|
||||||
results.add(transformSourceRecords(record));
|
for (OMElement record : omElements) {
|
||||||
|
results.add(transformSourceRecords(record));
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getQuery(Query query) {
|
private String getQuery(Query query) {
|
||||||
|
Reference in New Issue
Block a user