forked from D-Net/dnet-hadoop
log message
This commit is contained in:
parent
5cdba9172b
commit
bbe52584f7
|
@ -76,7 +76,6 @@ public class ResearchFiIterator implements Iterator<String> {
|
||||||
|
|
||||||
this.currPage += 1;
|
this.currPage += 1;
|
||||||
|
|
||||||
try (final CloseableHttpClient client = HttpClients.createDefault()) {
|
|
||||||
final String url;
|
final String url;
|
||||||
if (!this.baseUrl.contains("?")) {
|
if (!this.baseUrl.contains("?")) {
|
||||||
url = String.format("%s?PageNumber=%d&PageSize=%d", this.baseUrl, this.currPage, PAGE_SIZE);
|
url = String.format("%s?PageNumber=%d&PageSize=%d", this.baseUrl, this.currPage, PAGE_SIZE);
|
||||||
|
@ -87,6 +86,8 @@ public class ResearchFiIterator implements Iterator<String> {
|
||||||
}
|
}
|
||||||
log.info("Calling url: " + url);
|
log.info("Calling url: " + url);
|
||||||
|
|
||||||
|
try (final CloseableHttpClient client = HttpClients.createDefault()) {
|
||||||
|
|
||||||
final HttpGet req = new HttpGet(url);
|
final HttpGet req = new HttpGet(url);
|
||||||
req.addHeader("Authorization", "Bearer " + this.authToken);
|
req.addHeader("Authorization", "Bearer " + this.authToken);
|
||||||
try (final CloseableHttpResponse response = client.execute(req)) {
|
try (final CloseableHttpResponse response = client.execute(req)) {
|
||||||
|
@ -107,8 +108,8 @@ public class ResearchFiIterator implements Iterator<String> {
|
||||||
jsonArray.forEach(obj -> this.queue.add(JsonUtils.convertToXML(obj.toString())));
|
jsonArray.forEach(obj -> this.queue.add(JsonUtils.convertToXML(obj.toString())));
|
||||||
}
|
}
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
log.warn("Error obtaining access token", e);
|
log.warn("Error calling url: " + url, e);
|
||||||
throw new CollectorException("Error obtaining access token", e);
|
throw new CollectorException("Error calling url: " + url, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue