summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradam <adam.krysiak@nokia.com>2018-10-02 15:06:43 +0200
committeradam <adam.krysiak@nokia.com>2018-10-02 17:05:23 +0200
commit0b56ef142edabc965a3379d6edf83def65d38ec0 (patch)
tree489b52330cf2ff978e2b8eb55442c83a82af6aaa
parent2786c4e256e149ad5967f618017de54d5dc5566e (diff)
not catching all exceptions when invalid request
Change-Id: Ibf987d6c1b915a5ed13faba4f71b375a6532f5de Issue-ID: VID-318 Signed-off-by: adam <adam.krysiak@nokia.com>
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java b/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java
index 84e83e8b..b7f22640 100644
--- a/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java
@@ -23,6 +23,7 @@ package org.onap.vid.client;
import io.joshworks.restclient.http.HttpResponse;
import io.joshworks.restclient.http.JsonNode;
import io.joshworks.restclient.http.RestClient;
+import io.joshworks.restclient.http.exceptions.RestClientException;
import io.joshworks.restclient.http.mapper.ObjectMapper;
import org.apache.http.impl.client.CloseableHttpClient;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
@@ -39,7 +40,7 @@ import java.security.UnrecoverableKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.KeyManagementException;
import java.security.cert.CertificateException;
-import javax.net.ssl.SSLHandshakeException;
+import javax.net.ssl.SSLException;
import java.security.KeyStoreException;
import java.text.SimpleDateFormat;
import javax.net.ssl.SSLContext;
@@ -150,13 +151,13 @@ public class SyncRestClient implements SyncRestClientInterface {
@SneakyThrows
private <T> HttpResponse<T> callWithRetryOverHttp(String url,
- CheckedFunction1<String, HttpResponse<T>> httpRequest) {
+ CheckedFunction1<String, HttpResponse<T>> httpRequest) {
try {
return httpRequest.apply(url);
- } catch (Exception e) {
- if (e.getCause() instanceof SSLHandshakeException) {
+ } catch (RestClientException e) {
+ if (e.getCause() instanceof SSLException) {
logger.warn(EELFLoggerDelegate.debugLogger,
- DATE_FORMAT.format(new Date()) + TRY_TO_CALL_OVER_HTTP, e);
+ DATE_FORMAT.format(new Date()) + TRY_TO_CALL_OVER_HTTP, e);
return httpRequest.apply(url.replaceFirst(HTTPS_SCHEMA, HTTP_SCHEMA));
}
throw e;