Search code examples
activitibpmn

Activiti bpmn - missing variable comparision to false


In my BPMN file I have an gateway defined as follows:

<exclusiveGateway id="gateway" name="An gateway"/>

<sequenceFlow id="sequence1" sourceRef="gateway"
        targetRef="task1">
    <conditionExpression xsi:type="tFormalExpression">${variableABC == true}
    </conditionExpression>
</sequenceFlow>

<sequenceFlow id="sequence2" sourceRef="gateway"
        targetRef="task2">
        <conditionExpression xsi:type="tFormalExpression">${variableABC == false}
    </conditionExpression>
</sequenceFlow>

I wonder what is going to happen when the variable variableABC is missing (not set in the workflow engine)?

From my tests it seems that the flow will go to second branch. Could anyone explain why?

In Java null == false would throw an exception (?). How does activiti engine works in this situation? Thanks


Solution

  • Of course, it will go to the Second path if no value is provided. by default value of boolean is always false. it's a common java logic. for String, If no default path is provided then null value of expression, Activiti will throw an exception saying - no path/default found after Gateway.