In my process diagram, I have a multi-instance sub-process. Inside the sub-process the start event transitions to a service task which has a boundary error event on it.
The service task tries to get the loop counter from the local scope using execution.getVariableLocal("num") but it cannot. The loop counter can be retrieved using execution.getVariable("num") though. After some debugging I've found that when the service task has the boundary error event on it, an additional, empty variable scope is created as a child of the scope which contains the "num" variable. If the service task has no boundary error event, Activiti will no create the extra child scope.
It seems to come down to the ActivityImpl object representing the service task having the "isScope" flag set to true when the boundary error event is on the service task.
Is this desired behaviour? Should a new scope be created when entering a service task with a boundary error event on it?