From 08fdefa42dbfd664abe4675713a9e635e6fa24a2 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Tue, 18 Feb 2020 18:09:40 +0000 Subject: Adding sync mechanism Change-Id: I81dc737c27092d32bac6457ba015f0b093cb1176 Issue-ID: SO-2418 Signed-off-by: waqas.ikram --- .../onap/so/rest/service/HttpRestServiceProviderImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'common/src/main/java/org') 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, -- cgit 1.2.3-korg