diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2019-08-05 10:56:25 +0300 |
---|---|---|
committer | Eylon Malin <eylon.malin@intl.att.com> | 2019-08-05 10:56:25 +0300 |
commit | ce4838cf3836facbe397b25440922320b421141a (patch) | |
tree | 4f359fb17e03dee9d786e6ed068dd4987be6c98f /vid-app-common/src/main/java/org | |
parent | c459c7efeafd556333c46c65fc4fe2616d3ef532 (diff) |
change management return 400 handling NPE
return 400 internal status when exception is thrown during extracting serviceInstanceId
Issue-ID: VID-378
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Change-Id: I97f740de0a700f503d115033980f8e8366e806e7
Diffstat (limited to 'vid-app-common/src/main/java/org')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java index 814959020..214eec79d 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java @@ -162,13 +162,19 @@ public class ChangeManagementServiceImpl implements ChangeManagementService { protected String extractServiceInstanceId(RequestDetails currentRequestDetails, String requestType) { - String serviceInstanceId = currentRequestDetails.getRelatedInstList().get(0) - .getRelatedInstance().getInstanceId(); - if (serviceInstanceId == null) { + try { + String serviceInstanceId = currentRequestDetails.getRelatedInstList().get(0) + .getRelatedInstance().getInstanceId(); + if (serviceInstanceId == null) { + logger.error("Failed to extract serviceInstanceId"); + throw new BadRequestException("No instanceId in request " + requestType); + } + return serviceInstanceId; + } + catch (Exception e) { logger.error("Failed to extract serviceInstanceId"); throw new BadRequestException("No instanceId in request " + requestType); } - return serviceInstanceId; } @Override |