flowable / flowable/flowable-engine

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

Đang mở
#2 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
9.5k
Fork
2.9k
Merge trung bình
7 giờ 8 phút
Pull request đã merge (30 ngày)
2

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.