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

ClassCastException when executing CaseVariableListener

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: L3 - Default
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.3.0, 7.2.3, 7.3.0-alpha1
    • Component/s: engine
    • Labels:
      None

      Description

      See user forum:
      https://groups.google.com/forum/#!topic/camunda-bpm-users/URuVUbMKlFc

      The implementation of "CaseVariableListenerInvocation#invoke()" tries to get the current CaseExecution from the "Context#executionContextStackThreadLocal". But instead of an expected instance of "CaseExecutionContext" a instance of "BpmnExecutionContext" will be returned. This happens because a process instance has been executed (triggered by a ProcessTask inside the case instance).

      Possible solution:
      "CaseVariableListenerInvocation#invoke()" should be implemented like this:

      protected void invoke() throws Exception {
      try {
      if (contextExecution instanceof CaseExecutionEntity)

      { Context.setExecutionContext((CaseExecutionEntity) contextExecution); }

      variableListenerInstance.notify(variableInstance);
      }
      finally {
      if (contextExecution instanceof CaseExecutionEntity)

      { Context.removeExecutionContext(); }

      }
      }

      Hints:
      Clarify why it is necessary to call "Context#getCaseExecutionContext()" inside the "invoke()" method?

        Attachments

          Activity

            People

            Assignee:
            thorben.lindhauer Thorben Lindhauer
            Reporter:
            roman.smirnov Smirnov Roman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: