diff options
author | Steve Smokowski <ss835w@att.com> | 2019-04-05 13:45:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-05 13:45:29 +0000 |
commit | 8dcb6c2cfe69e95e22601eb1b15b6cbaa6b8746a (patch) | |
tree | 03f0eac860c489f81c31158f9e34885ca79369fc /adapters/mso-adapter-utils/src/main/java/org | |
parent | 7350292687c521002a4abbcc9f1d24cc37caf13f (diff) | |
parent | 608a077f8ea3b18dddbfeb4d8b486661e05561c7 (diff) |
Merge "Fixed Sonar blocker issues"
Diffstat (limited to 'adapters/mso-adapter-utils/src/main/java/org')
-rw-r--r-- | adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index ccdcf92953..1fabcb279c 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -71,6 +71,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ public static final String VNF_ID = "vnf_id"; public static final String VF_MODULE_ID = "vf_module_id"; public static final String TEMPLATE_TYPE = "template_type"; + public static final String MULTICLOUD_QUERY_BODY_NULL = "multicloudQueryBody is null"; public static final List<String> MULTICLOUD_INPUTS = Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE); @@ -302,11 +303,16 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase()); } else if (response.getStatus() == Response.Status.OK.getStatusCode() && response.hasEntity()) { multicloudQueryBody = getQueryBody((java.io.InputStream)response.getEntity()); - returnInfo.setCanonicalName(stackName + "/" + multicloudQueryBody.getWorkloadId()); - returnInfo.setStatus(getHeatStatus(multicloudQueryBody.getWorkloadStatus())); - returnInfo.setStatusMessage(multicloudQueryBody.getWorkloadStatus()); - if (logger.isDebugEnabled()) { - logger.debug("Multicloud Create Response Body: " + multicloudQueryBody.toString()); + if (multicloudQueryBody != null) { + returnInfo.setCanonicalName(stackName + "/" + multicloudQueryBody.getWorkloadId()); + returnInfo.setStatus(getHeatStatus(multicloudQueryBody.getWorkloadStatus())); + returnInfo.setStatusMessage(multicloudQueryBody.getWorkloadStatus()); + if (logger.isDebugEnabled()) { + logger.debug("Multicloud Create Response Body: " + multicloudQueryBody.toString()); + } + } else { + returnInfo.setStatus(HeatStatus.FAILED); + returnInfo.setStatusMessage(MULTICLOUD_QUERY_BODY_NULL); } } else { returnInfo.setStatus(HeatStatus.FAILED); @@ -624,7 +630,9 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ } private HeatStatus mapResponseToHeatStatus(Response response) { - if (response.getStatusInfo().getStatusCode() == Response.Status.OK.getStatusCode()) { + if (response == null) { + return HeatStatus.FAILED; + } else if (response.getStatusInfo().getStatusCode() == Response.Status.OK.getStatusCode()) { return HeatStatus.CREATED; } else if (response.getStatusInfo().getStatusCode() == Response.Status.CREATED.getStatusCode()) { return HeatStatus.CREATED; |