Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-14189

TypedValueBuilders as execution variable lose transient flag

XMLWordPrintable

    • Icon: Bug Report Bug Report
    • Resolution: Fixed
    • Icon: L3 - Default L3 - Default
    • 7.17.0, 7.17.0-alpha5
    • 7.16.0
    • engine
    • None

      Environment (Required on creation):

      • All distros

      Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

      • Setting a variable with a value of TypedValueBuilder on an execution ignores the "transient" flag of that builder.
      • Other API methods regarding variables allow to set TypedValueBuilders and treat those values similar to TypedValues, e.g. by calling #create on them and handling the created TypedValue henceforth

      Steps to reproduce (Required on creation):

       

      @Test
      public void testTransientVariable() {
        BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("foo")
          .startEvent()
          .serviceTask()
            .camundaDelegateExpression("${fooDelegate}").camundaAsyncAfter()
          .endEvent()
          .done();
        testRule.deploy(modelInstance);  JavaDelegate delegate = execution -> execution.setVariable("myVar", Variables.objectValue("Oops", true));
        Mocks.register("fooDelegate",delegate);
        // when
        ProcessInstance pi = runtimeService.startProcessInstanceByKey("foo");
        // then
        assertThat(runtimeService.getVariables(pi.getId())).doesNotContainKey("myVar");
      }

       

      Observed Behavior (Required on creation):

      The variable "myVar" is stored in the execution

      Expected behavior (Required on creation):

      The variable should not be stored since it's transient.

      Root Cause (Required on prioritization):

      • AbstractVariableScope#setVariableLocal calls Variables#untypedValue(Object)
      • The untypedValue method only inspects TypedValues' transient flag, builders are handled as ordinary objects and are marked as non-transient

      Solution Ideas (Optional):

      • Variables#untypedValue(Object) additionally check for TypedValueBuilders and pass on the transient flag correctly.

      Hints (optional):

        This is the controller panel for Smart Panels app

              Unassigned Unassigned
              criew Christoph Ewerlin
              Tobias Metzke-Bernstein Tobias Metzke-Bernstein
              Nikola Koevski Nikola Koevski
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: