-
Bug Report
-
Resolution: Cannot Reproduce
-
L3 - Default
-
None
-
None
-
None
The problem is that the FAIL_ON_UNKNOWN_PROPERTIES [1] is configured by default [2] in the external task java client but you still receive UnrecognizedPropertyException.
Scenario:
1. Create a process application containing:
- Foo object with two fields: 'knownProp' and 'newProp'
- A process with an external task
- Configure the PA to start the process with serialized Foo object as a variable.
ObjectValueBuilder serializationDataFormat = Variables.objectValue(new Foo(newProp, knownProp)).serializationDataFormat(SerializationDataFormats.JSON); processEngine.getRuntimeService().startProcessInstanceByKey(key, Variables.createVariables().putValue("foo", serializationDataFormat));
2. Create an external task client containing a Sample object with only one field 'knownProp'
3. Deploy the application
4. Try to fetch and lock the external task and get the foo variable
externalTask.getVariableTyped("foo");
Current:
Receive an exception:
4157 [TopicSubscriptionManager] ERROR org.camunda.bpm.client - TASK/CLIENT-03004 Exception on external task service method invocation for topic 'topic1': org.camunda.bpm.client.exception.ValueMapperException: TASK/CLIENT-01021 Exception while mapping value: Cannot deserialize object in variable. at org.camunda.bpm.client.impl.ExternalTaskClientLogger.valueMapperExceptionWhileDeserializingObject(ExternalTaskClientLogger.java:168) at org.camunda.bpm.client.variable.impl.mapper.ObjectValueMapper.readValue(ObjectValueMapper.java:80) at org.camunda.bpm.client.variable.impl.mapper.ObjectValueMapper.readValue(ObjectValueMapper.java:32) at org.camunda.bpm.client.variable.impl.VariableValue.getTypedValue(VariableValue.java:58) at org.camunda.bpm.client.task.impl.ExternalTaskImpl.getVariableTyped(ExternalTaskImpl.java:271) at org.camunda.bpm.client.task.impl.ExternalTaskImpl.getVariableTyped(ExternalTaskImpl.java:260) at org.camunda.bpm.App.lambda$0(App.java:37) at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.handleExternalTask(TopicSubscriptionManager.java:143) at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.lambda$acquire$0(TopicSubscriptionManager.java:102) at java.util.Arrays$ArrayList.forEach(Arrays.java:3880) at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.acquire(TopicSubscriptionManager.java:97) at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.run(TopicSubscriptionManager.java:81) at java.lang.Thread.run(Thread.java:745) Caused by: org.camunda.bpm.client.exception.DataFormatException: TASK/CLIENT-05001 Unable to read value '{"newProp":"value1","knownProp":"value2"}' to object at org.camunda.bpm.client.variable.impl.format.json.JacksonJsonLogger.unableToReadValue(JacksonJsonLogger.java:21) at org.camunda.bpm.client.variable.impl.format.json.JacksonJsonDataFormat.readValue(JacksonJsonDataFormat.java:99) at org.camunda.bpm.client.variable.impl.format.json.JacksonJsonDataFormat.readValue(JacksonJsonDataFormat.java:83) at org.camunda.bpm.client.variable.impl.mapper.ObjectValueMapper.readValue(ObjectValueMapper.java:77) ... 11 more Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "newProp" (class org.camunda.Foo), not marked as ignorable (one known property: "newProp"]) at [Source: (String)"{"newProp":"value1","knownProp":"value2"}"; line: 1, column: 22] (through reference chain: org.camunda.Foo["knownProp"]) at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61) at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:822) at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1152) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1582) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1560) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2992) at org.camunda.bpm.client.variable.impl.format.json.JacksonJsonDataFormat.readValue(JacksonJsonDataFormat.java:93) ... 13 more
Expected:
No error is thrown, the application should fail when it encounter new property.
[1]: https://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/DeserializationFeature.html#FAIL_ON_UNKNOWN_PROPERTIES
[2]: https://github.com/camunda/camunda-external-task-client-java/blob/33eaca4e27d5b09e73bdf9e70479b51e8688981b/client/src/main/java/org/camunda/bpm/client/impl/ExternalTaskClientBuilderImpl.java#L210