From 70ded407bbefbc3c777fc82697c08a7254a64df8 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Mon, 5 Jul 2021 18:04:30 +0200 Subject: [PATCH] HttpClient used in metadata collection retries also on 404 --- .../eu/dnetlib/dhp/collection/HttpConnector2.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/HttpConnector2.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/HttpConnector2.java index a84b269551..a61e2032c6 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/HttpConnector2.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/collection/HttpConnector2.java @@ -131,18 +131,9 @@ public class HttpConnector2 { } return attemptDownload(newUrl, retryNumber + 1, report); } - if (is4xx(urlConn.getResponseCode())) { - // CLIENT ERROR, DO NOT RETRY - report - .put( - REPORT_PREFIX + urlConn.getResponseCode(), - String - .format( - "%s error: %s", requestUrl, urlConn.getResponseMessage())); - throw new CollectorException("4xx error: request will not be repeated. " + report); - } - if (is5xx(urlConn.getResponseCode())) { + if (is4xx(urlConn.getResponseCode()) || is5xx(urlConn.getResponseCode())) { switch (urlConn.getResponseCode()) { + case HttpURLConnection.HTTP_NOT_FOUND: case HttpURLConnection.HTTP_BAD_GATEWAY: case HttpURLConnection.HTTP_UNAVAILABLE: case HttpURLConnection.HTTP_GATEWAY_TIMEOUT: