diff options
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java index 35ceef0473..4d2f9fd98c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java @@ -125,7 +125,7 @@ public class WorkflowActionBBFailure { } private Optional<String> retrieveErrorMessage(DelegateExecution execution) { - String errorMsg = ""; + String errorMsg = null; try { WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); if (exception != null && (exception.getErrorMessage() != null || !exception.getErrorMessage().equals(""))) { @@ -134,6 +134,10 @@ public class WorkflowActionBBFailure { if (errorMsg == null || errorMsg.equals("")) { errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage"); } + if (errorMsg == null) { + throw new IllegalStateException( + "could not find WorkflowException or WorkflowExceptionErrorMessage in execution"); + } return Optional.of(errorMsg); } catch (Exception ex) { logger.error("Failed to extract workflow exception from execution.", ex); |