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

ClassCastException when executing CaseVariableListener

    XMLWordPrintable

Details

    • Bug Report
    • Resolution: Fixed
    • L3 - Default
    • 7.3.0, 7.2.3, 7.3.0-alpha1
    • None
    • engine
    • 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?

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Salesforce