Claus Ibsen created CAMEL-26003:
-----------------------------------
Summary: camel-flatpack - marshal of a single Map fails with a
ClassCastException, and the data format name is flatback
Key: CAMEL-26003
URL: https://issues.apache.org/jira/browse/CAMEL-26003
Project: Camel
Issue Type: Bug
Components: camel-flatpack
Affects Versions: 4.18.0, 4.22.0, 4.23.0
Reporter: Claus Ibsen
Fix For: 4.24.0
Two problems with the flatpack data format:
* *A single Map*: marshal casts the body to {{List<Map<String, Object>>}}
without a check ({{FlatpackDataFormat}}, main 50d17f9c2614, line 83). A single
Map, one row, fails with {{ClassCastException: class java.util.LinkedHashMap
cannot be cast to class java.util.List}}, and a String fails the same way. The
csv and univocity data formats take a single Map as one row.
* *The name*: {{getDataFormatName()}} returns {{flatback}} (line 75). The name
shows in JMX and in the error for a null body: "Cannot unmarshal using
flatback: the body is null". This was listed among the low findings of
CAMEL-24170.
Checked on 4.24.0-SNAPSHOT with {{camel run}}: marshal of a {{LinkedHashMap}}
gives the ClassCastException, and unmarshal of a null body gives the message
with {{flatback}}.
*Proposed change*: write a single Map as one row, fail with an
{{InvalidPayloadException}} for other bodies, and return {{flatpack}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)