summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java/org
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2019-06-18 17:43:21 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-06-18 17:43:27 -0400
commitaf652e0dc40b6bd319a61747404a109eeebbc1a0 (patch)
tree6b8a84b873bfebfec9e14abad1f1f594ff13de43 /mso-api-handlers/mso-api-handler-infra/src/main/java/org
parent7c69f07593a8c7474bd7a69a65979dc0635f1526 (diff)
NPE when setting instanceName
Added null check to fix NPE when setting instanceName Added check for null instanceName for vfModule Change-Id: Ie70651770466790fd1f9d666eeabdce26510b01b Issue-ID: SO-2034 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java19
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(