summaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
authorBENJAMIN, MAX <max.benjamin@att.com>2021-03-04 10:14:40 -0500
committerAT&T Open Source <g22940@att.com>2021-03-04 10:14:41 -0500
commit3c620816d120e795a8f2751e0e552126991a90b6 (patch)
tree4a4cb32c0f71206d865c26bf480f136c62633e06 /common/src
parentc9f50f006d87826611043c37fdb41f1a27ac8216 (diff)
retry on ResponseProcessingException
retry on ResponseProcessingException Issue-ID: SO-3570 Signed-off-by: AT&T Open Source <g22940@att.com> Change-Id: I62745d3833bec8fb5f33007aa613ff4626b5486d
Diffstat (limited to 'common/src')
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java2
-rw-r--r--common/src/test/java/org/onap/so/client/RestClientTest.java16
2 files changed, 17 insertions, 1 deletions
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index d1b4c2b900..0df378db66 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -248,7 +248,7 @@ public abstract class RestClient {
return e.getCause() instanceof ConnectException;
});
result.add(e -> {
- return e.getCause() instanceof ResponseProcessingException;
+ return e instanceof ResponseProcessingException;
});
return result;
}
diff --git a/common/src/test/java/org/onap/so/client/RestClientTest.java b/common/src/test/java/org/onap/so/client/RestClientTest.java
index 3bf4ccf127..b5efa17216 100644
--- a/common/src/test/java/org/onap/so/client/RestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/RestClientTest.java
@@ -34,9 +34,11 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Optional;
+import javax.net.ssl.SSLException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriBuilderException;
@@ -81,6 +83,20 @@ public class RestClientTest {
}
@Test
+ public void retryOnChunkedNetworkIssue() throws Exception {
+ RestClient spy = buildSpy();
+ doThrow(new ResponseProcessingException(null, "something something", new SSLException("wow"))).when(spy)
+ .buildRequest(any(String.class), ArgumentMatchers.isNull());
+ try {
+ spy.get();
+ } catch (Exception e) {
+ // ignore this exception for this test
+ }
+ verify(spy, times(3)).buildRequest(any(String.class), ArgumentMatchers.isNull());
+
+ }
+
+ @Test
public void exceptionDoNotRetry() throws Exception {
RestClient spy = buildSpy();
doThrow(new WebApplicationException(new NotFoundException())).when(spy).buildRequest(any(String.class),