summaryrefslogtreecommitdiffstats
path: root/common/src/main
diff options
context:
space:
mode:
authorByung-Woo Jun <byung-woo.jun@est.tech>2020-02-19 12:37:37 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-19 12:37:37 +0000
commitc8b62275a8cb5f10ab2050f2cee71973485fbbd7 (patch)
tree1cc9e1ab2fbcb777a34394a237618292a67ed7cc /common/src/main
parent493477ef59ce12d082683f188e0253fe2d34bdff (diff)
parent08fdefa42dbfd664abe4675713a9e635e6fa24a2 (diff)
Merge "Adding sync mechanism"
Diffstat (limited to 'common/src/main')
-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,