aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/main/java
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@est.tech>2020-02-18 18:09:40 +0000
committerwaqas.ikram <waqas.ikram@est.tech>2020-02-19 10:29:10 +0000
commit08fdefa42dbfd664abe4675713a9e635e6fa24a2 (patch)
treefc2c5577f89b6173e2253c8f32494cc017d94a90 /common/src/main/java
parenta71813fd697298b9a9bddea6eacc9de5fada2de0 (diff)
Adding sync mechanism
Change-Id: I81dc737c27092d32bac6457ba015f0b093cb1176 Issue-ID: SO-2418 Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'common/src/main/java')
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
index b82d73bbbf..6211b76561 100644
--- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
@@ -143,6 +143,18 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders());
return restTemplate.exchange(url, HttpMethod.DELETE, request, clazz);
+ } catch (final HttpStatusCodeException httpStatusCodeException) {
+ final String message = "Unable to invoke HTTP " + HttpMethod.DELETE + " using url: " + url + ", Response: "
+ + httpStatusCodeException.getRawStatusCode();
+ LOGGER.error(message, httpStatusCodeException);
+ final int rawStatusCode = httpStatusCodeException.getRawStatusCode();
+ if (rawStatusCode == HttpStatus.BAD_REQUEST.value()) {
+ throw new InvalidRestRequestException("No result found for given url: " + url);
+ } else if (rawStatusCode == HttpStatus.NOT_FOUND.value()) {
+ throw new HttpResouceNotFoundException("No result found for given url: " + url);
+ }
+ throw new RestProcessingException("Unable to invoke HTTP " + HttpMethod.DELETE + " using URL: " + url,
+ httpStatusCodeException, rawStatusCode);
} catch (final RestClientException restClientException) {
LOGGER.error("Unable to invoke HTTP DELETE using url: " + url, restClientException);
throw new InvalidRestRequestException("Unable to invoke HTTP DELETE using URL: " + url,