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

Removal of transient variable followed by set with non-transient leads to NPE

    XMLWordPrintable

Details

    Description

      Environment (Required on creation):

      All distros, all databases.

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

      Deleting a transient variable followed by setting a non-transient variable with the same name leads to a NullPointerException.

      java.lang.NullPointerException
          at org.camunda.bpm.engine.impl.db.entitymanager.cache.DbEntityCache.undoDelete(DbEntityCache.java:385)
          at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.undoDelete(DbEntityManager.java:560)
          at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariableLocal(AbstractVariableScope.java:337)
          at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariable(AbstractVariableScope.java:307)
          at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariable(AbstractVariableScope.java:288)
          at com.hannoverre.hippo.hppp501.process.listener.MappingOrderLinkedEventListener.execute(MappingOrderLinkedEventListener.java:63)
          at org.camunda.bpm.engine.impl.bpmn.delegate.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:40) 

      Steps to reproduce (Required on creation):

      1. Start a process with a transient variable A
      2. Before reaching a transaction boundary, remove the variable by calling execution.removeVariable("A");, followed by setting a non-transient variable with the same name, e.g. via execution.setVariable("A", "foo");

      Observed Behavior (Required on creation):

      A NullPointerException is thrown.

      Expected behavior (Required on creation):

      Either:

      • An error message is thrown similar to the one thrown when trying to overwrite a transient variable with a non-transient one and vice versa
      • This chain of command is allowed and the non-transient variable is treated as a new variable that will be persisted

      Root Cause (Required on prioritization):

      Solution Ideas (Optional):

      • Decide, if this chain of command
        1. Yields an error message similar to the one when overriding a transient variable with a non-transient one
        2. Is allowed and transforms a transient variable to a non-transient one and vice versa with all necessary considerations (like history events and correct initial DB state).

      Hints (optional):

      Deciding for allowing this chain of command would finally allow transforming transient variables to non-transient ones and vice versa. Since this would now require an explicit removal followed by a set, one could argue that the intent is clearly conveyed now and therefore less error-prone and more transparent compared to allowing a simple override via the setVariable method.

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

              Unassigned Unassigned
              tobias.metzke Tobias Metzke-Bernstein
              Tobias Metzke-Bernstein Tobias Metzke-Bernstein
              Nikola Koevski Nikola Koevski
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Salesforce