aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleksandr Moliavko <o.moliavko@samsung.com>2019-09-26 09:21:39 +0300
committerOleksandr Moliavko <o.moliavko@samsung.com>2019-10-04 17:25:03 +0300
commit34d989b755a47e900824a0316b122226ee05f7e0 (patch)
tree280400bc0477998f473c44dd33090c7c425ba522
parent0966d538f7f04dbb99e5028e09057a3e8f866cab (diff)
Added null checks for bp to prevent exceptions at
bp.getId() calls; fixed omissions in methods control logic; removed unneeded catch blocks Issue-ID: SO-1841 Signed-off-by: Oleksandr Moliavko <o.moliavko@samsung.com> Change-Id: I8347b953381ebb4a112a22fc8c58a9a32f2dbfb7
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index 2a17656f1d..f1c42bb4a5 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -751,16 +751,19 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
GetBlueprint getRequest = cloudify.blueprints().getMetadataById(blueprintId);
try {
Blueprint bp = getRequest.execute();
- logger.debug("Blueprint exists: {}", bp.getId());
- return true;
+ if (bp != null) {
+ logger.debug("Blueprint exists: {}", bp.getId());
+ return true;
+ } else {
+ logger.debug("Null blueprint!");
+ return false;
+ }
} catch (CloudifyResponseException ce) {
if (ce.getStatus() == 404) {
return false;
} else {
throw ce;
}
- } catch (Exception e) {
- throw e;
}
}
@@ -799,8 +802,12 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
GetBlueprint getRequest = cloudify.blueprints().getMetadataById(blueprintId);
try {
Blueprint bp = getRequest.execute();
- logger.debug("Blueprint {} already exists.", bp.getId());
- return false;
+ if (bp != null) {
+ logger.debug("Blueprint {} already exists.", bp.getId());
+ return false;
+ } else {
+ logger.debug("Null blueprint!");
+ }
} catch (CloudifyResponseException ce) {
if (ce.getStatus() == 404) {
// This is the expected result.
@@ -808,8 +815,6 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
} else {
throw ce;
}
- } catch (Exception e) {
- throw e;
}
// Create a blueprint ZIP file in memory