flowable / flowable/flowable-engine
variable instance lost because RuntimeService#setVariable behaves like VariableScope#setVariable(_,_,false)
- Langage dominant
- Java
- Étoiles
- 9.5k
- Forks
- 2.9k
- Merge moyen
- 7 h 8 min
- PR mergées (30 j)
- 2
Description
We're trying to upgrade from activiti 5.9 to flowable 5.22.0 but our test-cases fail with 5.22.0. We depend on `RuntimeService#setVariable` to set a variable instance for a nested workflow. Unfortunately the variable is gone by the time we need it. Our method works with 5.9.
When debugging we see that `SetExecutionVariablesCmd#execute` is called which executes [VariableScope#setVariable(String variableName, Object value, boolean fetchAllVariables)](http://www.flowable.org/docs/javadocs/org/activiti/engine/delegate/VariableScope.html#setVariable-java.lang.String-java.lang.Object-boolean-) with `fetchAllVariables == false`. This is counter-intuitive to me because the documentation of [RuntimeService#setVariable](http://www.flowable.org/docs/javadocs/org/activiti/engine/RuntimeService.html#setVariable-java.lang.String-java.lang.String-java.lang.Object-) refers to [VariableScope#setVariable(String, Object)](http://www.flowable.org/docs/javadocs/org/activiti/engine/delegate/VariableScope.html#setVariable-java.lang.String-java.lang.Object-) which defaults to `fetchAllVariables == true`.
As a consequence of `fetchAllVariables == false` we end up in `VariableScopeImpl#createVariableInstance` with `variableInstances == null`, the `put` operation doesn't take place and the variable only gets written to the `VariableScopeImpl#usedVariablesCache`.
Is there a call to `VariableScopeImpl#ensureVariableInstancesInitialized()` missing in `VariableScopeImpl#createVariableInstance` or should `SetExecutionVariablesCmd` use `fetchAllVariables == true` or is this a new expected behavior and we should use another method to set our variables?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.