flowable / flowable/flowable-engine

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

オープン
#2 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
9.5k
フォーク
2.9k
平均マージ
7時間 8分
マージ済み PR(30日)
2

説明

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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。