aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-10-04 15:40:52 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-04 15:40:52 +0000
commit3c68b089f1782befe61096549fa0916367751672 (patch)
tree25ea4e613d39a3d1df86875c7ceb1a2aa1d2b72f /adapters
parentaf150f32a5644719f7b29a1be513190c865b5f74 (diff)
parent34d989b755a47e900824a0316b122226ee05f7e0 (diff)
Merge "Added null checks for bp to prevent exceptions at bp.getId() calls; fixed omissions in methods control logic; removed unneeded catch blocks"
Diffstat (limited to 'adapters')
-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 ad2543032f..d7bc22aa7c 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
@@ -755,16 +755,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;
}
}
@@ -803,8 +806,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.
@@ -812,8 +819,6 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
} else {
throw ce;
}
- } catch (Exception e) {
- throw e;
}
// Create a blueprint ZIP file in memory