improve error handling in postProcessingExecuteBB 64/118864/2
authorKALKERE RAMESH, SHARAN <sharan.kalkere.ramesh@att.com>
Fri, 5 Mar 2021 17:50:00 +0000 (12:50 -0500)
committerBenjamin, Max (mb388a) <mb388a@att.com>
Mon, 8 Mar 2021 01:14:45 +0000 (20:14 -0500)
improve error handling in postProcessingExecuteBB

Issue-ID: SO-3572
Signed-off-by: AT&T Open Source <g22940@att.com>
Change-Id: Idcccdf8f5f10db8445a42536d0bd891bc2cf5a42
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java

index ccefc77..ec2ca74 100644 (file)
@@ -420,18 +420,25 @@ public class WorkflowActionBBTasks {
     }
 
     public void postProcessingExecuteBB(DelegateExecution execution) {
-        List<ExecuteBuildingBlock> flowsToExecute =
-                (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
-        String handlingCode = (String) execution.getVariable(HANDLINGCODE);
-        final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
-        int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
-        ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
-        String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
-        if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) {
-            postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
-        }
+        try {
+            List<ExecuteBuildingBlock> flowsToExecute =
+                    (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+            String handlingCode = (String) execution.getVariable(HANDLINGCODE);
+            final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+            int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+            logger.debug("Current Sequence: {}", currentSequence);
+            ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
+            String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
+            if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte
+                    && "Success".equalsIgnoreCase(handlingCode)) {
+                postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
+            }
 
-        flowManipulatorListenerRunner.postModifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
+            flowManipulatorListenerRunner.postModifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
+        } catch (Exception ex) {
+            logger.error("Exception in postProcessingExecuteBB", ex);
+            workflowAction.buildAndThrowException(execution, "Failed to post process Execute BB");
+        }
     }
 
     protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution, ExecuteBuildingBlock ebb,