log message

This commit is contained in:
Michele Artini 2024-07-11 15:14:34 +02:00
parent 5cdba9172b
commit bbe52584f7
1 changed files with 12 additions and 11 deletions

View File

@ -76,7 +76,6 @@ public class ResearchFiIterator implements Iterator<String> {
this.currPage += 1;
try (final CloseableHttpClient client = HttpClients.createDefault()) {
final String url;
if (!this.baseUrl.contains("?")) {
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);
try (final CloseableHttpClient client = HttpClients.createDefault()) {
final HttpGet req = new HttpGet(url);
req.addHeader("Authorization", "Bearer " + this.authToken);
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())));
}
} catch (final Throwable e) {
log.warn("Error obtaining access token", e);
throw new CollectorException("Error obtaining access token", e);
log.warn("Error calling url: " + url, e);
throw new CollectorException("Error calling url: " + url, e);
}
}