aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/main
diff options
context:
space:
mode:
authorOleksandr Moliavko <o.moliavko@samsung.com>2019-08-19 17:56:28 +0300
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-08-21 08:37:24 +0000
commit1980b0e778ae30a15ee1fdf4685097e6a8bc1d0d (patch)
tree84fd815160ee09842fdd6eda2afa6eac104b500f /adapters/mso-adapter-utils/src/main
parent86bac35dfead00265a18944528b635a16ab96263 (diff)
Rewritten checks for status according to comments
Issue-ID: SO-1841 Signed-off-by: Oleksandr Moliavko <o.moliavko@samsung.com> Change-Id: I6023a043e2cf532de330060973d23a402a742e36
Diffstat (limited to 'adapters/mso-adapter-utils/src/main')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java14
1 files changed, 9 insertions, 5 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 e821d806dd..2a17656f1d 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
@@ -478,12 +478,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
boolean timedOut = false;
int cancelTimeout = timeout; // TODO: For now, just use same timeout
- String status = cancelExecution.getStatus();
-
+ String status = null;
+ if (cancelExecution != null) {
+ status = cancelExecution.getStatus();
+ }
// Poll for completion. Create a reusable cloudify query request
GetExecution queryExecution = cloudify.executions().byId(executionId);
- while (!timedOut && !status.equals(CANCELLED)) {
+ while (!timedOut && !CANCELLED.equals(status)) {
// workflow is still running; check for timeout
if (cancelTimeout <= 0) {
logger.debug("Cancel timeout for workflow {} on deployment {}", workflowId, deploymentId);
@@ -497,11 +499,13 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("pollTimeout remaining: {}", cancelTimeout);
execution = queryExecution.execute();
- status = execution.getStatus();
+ if (execution != null) {
+ status = execution.getStatus();
+ }
}
// Broke the loop. Check again for a terminal state
- if (status.equals(CANCELLED)) {
+ if (CANCELLED.equals(status)) {
// Finished cancelling. Return the original exception
logger.debug("Cancel workflow {} completed on deployment {}", workflowId, deploymentId);
throw new MsoCloudifyException(-1, "", "", savedException);