camunda-community-hub/camunda-tasklist-client-java

Complex variable values are not serialized correctly

falko opened this issue · 1 comments

falko commented

ApolloUtils#toVariableInput(Map<String, Object> variablesMap) lacks handling for lists of objects, i.e. it just calls String.valueOf(entry.getValue()), which produces an invalid serialization, e.g.

[{name=Allianz, email=allianz@example.org, premium=1}, {name=AXA, email=axa@example.org, selected=true, premium=2}, {name=Babylon, email=babylon@example.org, premium=3}, {name=SwissLife, email=swisslife@example.org, premium=4}, {name=Generali, email=generali@example.org, premium=5}]

Exception:

io.camunda.tasklist.exception.TaskListException: Error(message = Unexpected character ('n' (code 110)): was expecting double-quote to start field name
 at [Source: (String)"[{name=Allianz, email=allianz@example.org, premium=1}, {name=AXA, email=axa@example.org, selected=true, premium=2}, {name=Babylon, email=babylon@example.org, premium=3}, {name=SwissLife, email=swisslife@example.org, premium=4}, {name=Generali, email=generali@example.org, premium=5}]"; line: 1, column: 4], locations = [Location(line = 1, column = 70)], path=[completeTask], extensions = {type=TasklistRuntimeException, classification=DataFetchingException}, nonStandardFields = null)
        at io.camunda.tasklist.CamundaTaskListClient.execute(CamundaTaskListClient.java:137) ~[camunda-tasklist-client-java-1.2.1.jar:na]
        at io.camunda.tasklist.CamundaTaskListClient.completeTask(CamundaTaskListClient.java:50)

Expected would have been proper JSON:

[
  {
    "name": "Allianz",
    "email": "allianz@example.org"
  },
  {
    "name": "AXA",
    "email": "axa@example.org"
  },
  {
    "name": "Babylon",
    "email": "babylon@example.org"
  },
  {
    "name": "SwissLife",
    "email": "swisslife@example.org"
  },
  {
    "name": "Generali",
    "email": "generali@example.org"
  }
]

Well spotted :) Version 1.2.2 will correct this issue