-
Bug Report
-
Resolution: Won't Fix
-
L3 - Default
-
None
-
7.15.0
-
None
Environment (Required on creation):
camunda-bpm-spring-boot-starter-rest (7.15.0)
spring boot version (2.3.4.RELEASE)
camunda-spin-core (matching version from BOM)
camunda-engine-plugin-spi (matching version from BOM)
camunda-spin-dataformat-json-jackson (matching version from BOM)
Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):
Adding list variable containing elements of different types with application/json serialization format (using camunda-spin plugin) causes incorrect list's generic type changes, which are a reason of deserialization errors.
Steps to reproduce (Required on creation):
1. From REST Api, add new instance variable. Its value should be array with not matching element types, ex. integer, string, like below:
{ "value": "[123, \"str\"]", "type": "object", "valueInfo": { "objectTypeName": "java.util.ArrayList<java.lang.Object>", "serializationDataFormat": "application/json" } }
2. Get this variable once
3. Get this variable second time
Observed Behavior (Required on creation):
First retrieval of this variable returns correct value. However, 'objectTypeName' is changed from user-provided:
java.util.ArrayList<java.lang.Object>
to:
java.util.ArrayList<java.lang.Integer>
Second retrieval of this variable causes deserialization error (due to "str" variable being coerced to integer, which of course fails).
Observed behavior is the same as described in CAM-1175, except it is about lists/arrays, not maps.
Expected behavior (Required on creation):
1. List elements should not change their type during serialization.
2. Preferably, also type of whole list variable should not change, in case when complete, valid type was provided by user.
Root Cause (Required on prioritization):
Code in ListJacksonJsonTypeDetector.java, l. 40. Type detection is based always on first element of the list, even if subsequent elements have different type.
https://github.com/camunda/camunda-spin/blob/7a327b1bcdafbbb2a6548f48693b0913ecbb8d1d/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/ListJacksonJsonTypeDetector.java#L40
Solution Ideas (Optional):
List variable generic type could be:
1. not detected at all, when valid generic type is already provided by user
2. detected based on all elements of the array/list, not only first one.
In case of differences, either nearest common ancestor type could be used, or it could just be object (being common ancestor for all not-primitive types).
Hints (optional)
This issue is very similar to CAM-11175, except issue there was with map types, and here is with array/list types. All symptoms are however the same.
This is the controller panel for Smart Panels app
- is related to
-
CAM-11175 Remove MapJacksonJsonTypeDetector in camunda-spin
- Closed