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

Empty String variables are deserialized as null with Oracle DB

XMLWordPrintable

      Given

      • Oracle 19c DB
      • DMN with an empty string A as output
      • UserTask with CandidateGroup or CandidateUser referring to the value of A
      • wait state between business rule task and user task

      When

      • DMN is evaluated, Oracle DB stores empty string value as NULL

      Then

      • Following exception is thrown when the instance reaches UserTask:
        14:23:19.144 [camundaTaskExecutor-1] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: Expression did not resolve to a string or collection of strings
        org.camunda.bpm.engine.ProcessEngineException: Expression did not resolve to a string or collection of strings
        	at org.camunda.bpm.engine.impl.task.TaskDecorator.initializeTaskCandidateUsers(TaskDecorator.java:196)
        	at org.camunda.bpm.engine.impl.task.TaskDecorator.initializeTaskAssignments(TaskDecorator.java:150)
        	at org.camunda.bpm.engine.impl.task.TaskDecorator.decorate(TaskDecorator.java:63)
        	at org.camunda.bpm.engine.impl.bpmn.behavior.UserTaskActivityBehavior.performExecution(UserTaskActivityBehavior.java:59)
        	at org.camunda.bpm.engine.impl.bpmn.behavior.TaskActivityBehavior.execute(TaskActivityBehavior.java:69)
        	...
        

      Expected

      • Empty string is not transferred into NULL values.

      Rootcause

      • String variables with an empty String as a value are persisted as NULL in the field ACT_RU_VARIABLE.TEXT_. On deserialization, this value is deserialized to null instead of an empty String

      Solution idea

      • Extend the String value serializer so that for empty Strings it writes a value into TEXT2_ that indicates that this is an empty String and not null (e.g. by writing the value "empty")
      • Evaluate the text2 value when deserializing the variable
      • Extend the value matching conditions of the queries so that
        • Empty String values can be matched on Oracle (for equals and notEquals)
          • only evaluate this extra query condition if the text value is null => only in this case we need to make the distinction, so let's avoid the query complexity otherwise
          • only evaluate this extra query condition on Oracle (same reason)
        • The value is not matched if the query condition filters for a variable of another type that also writes to text2 (e.g. file variables)
      • Create sufficient test coverage to ensure that the variable filtering works in various APIs
      • Create tests that ensure that filtering by other values that write to text2 does not return String values

        This is the controller panel for Smart Panels app

              Unassigned Unassigned
              michal.dytko MichaƂ Dytko
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: