From 786eb8050017bfc4ebf5d8cddb7abca34a10e82b Mon Sep 17 00:00:00 2001 From: mpriyank Date: Wed, 23 Mar 2022 15:20:10 +0530 Subject: Exception scenario handling - Updated logic to throw exception when response code is not 2XX, previously it was checking for 201 CREATED Issue-ID: CPS-955 Change-Id: I45cc53cf5b0e603755a75dbd089ead0eb87e5970 Signed-off-by: mpriyank --- src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java index 4f126227..38b044db 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java @@ -134,7 +134,7 @@ public class DmiServiceImpl implements DmiService { "Parsing error occurred while converting given cm-handles object list to JSON "); } final ResponseEntity responseEntity = ncmpRestClient.registerCmHandlesWithNcmp(cmHandlesJson); - if ((responseEntity.getStatusCode() != HttpStatus.CREATED)) { + if (!responseEntity.getStatusCode().is2xxSuccessful()) { throw new CmHandleRegistrationException(responseEntity.getBody()); } } -- cgit 1.2.3-korg