diff options
author | Steve Smokowski <ss835w@att.com> | 2019-06-20 12:09:30 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-06-20 12:09:30 +0000 |
commit | 29344b13fbf8f0aaa395a7228c8e24a79fb2057a (patch) | |
tree | 525bc74dfa60fa9b89f99634701f43fdbc7cb11e /mso-api-handlers/mso-api-handler-infra/src/main | |
parent | 97d6a82ebbdfc88716e2070f972f40dd19e2a079 (diff) | |
parent | af652e0dc40b6bd319a61747404a109eeebbc1a0 (diff) |
Merge "NPE when setting instanceName"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java index f88d244a88..24034e91af 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java @@ -626,7 +626,7 @@ public class RequestHandlerUtils { protected InfraActiveRequests createNewRecordCopyFromInfraActiveRequest(InfraActiveRequests infraActiveRequest, String requestId, Timestamp startTimeStamp, String source, String requestUri, String requestorId, - String originalRequestId) { + String originalRequestId) throws ApiException { InfraActiveRequests request = new InfraActiveRequests(); request.setRequestId(requestId); request.setStartTime(startTimeStamp); @@ -649,11 +649,24 @@ public class RequestHandlerUtils { } protected void setInstanceIdAndName(InfraActiveRequests infraActiveRequest, - InfraActiveRequests currentActiveRequest) { + InfraActiveRequests currentActiveRequest) throws ApiException { String requestScope = infraActiveRequest.getRequestScope(); try { ModelType type = ModelType.valueOf(requestScope); - type.setName(currentActiveRequest, type.getName(infraActiveRequest)); + String instanceName = type.getName(infraActiveRequest); + if (instanceName == null && type.equals(ModelType.vfModule)) { + logger.error("vfModule for requestId: {} being resumed does not have an instanceName.", + infraActiveRequest.getRequestId()); + ValidateException validateException = new ValidateException.Builder( + "vfModule for requestId: " + infraActiveRequest.getRequestId() + + " being resumed does not have an instanceName.", + HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).build(); + updateStatus(currentActiveRequest, Status.FAILED, validateException.getMessage()); + throw validateException; + } + if (instanceName != null) { + type.setName(currentActiveRequest, instanceName); + } type.setId(currentActiveRequest, type.getId(infraActiveRequest)); } catch (IllegalArgumentException e) { logger.error( |