flowable / flowable/flowable-engine

variable instance lost because RuntimeService#setVariable behaves like VariableScope#setVariable(_,_,false)

Abierto
#2 4 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
9.5k
Forks
2.9k
Merge medio
7 h 8 min
PR fusionados (30 d)
2

Descripción

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?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.