Claus Ibsen created CAMEL-25997:
-----------------------------------
Summary: camel-bindy - marshal of a body that is not a model
object writes empty lines instead of failing
Key: CAMEL-25997
URL: https://issues.apache.org/jira/browse/CAMEL-25997
Project: Camel
Issue Type: Bug
Components: camel-bindy
Affects Versions: 4.18.0, 4.22.0, 4.23.0
Reporter: Claus Ibsen
Fix For: 4.24.0
Marshal with {{bindyCsv}} takes an object of the {{classType}} class, a List of
them, or a Map of the model class names to the objects ({{BindyCsvDataFormat}},
main 50d17f9c2614, lines 94-109). Any other body is taken as a model object
keyed by its own class name. The factory finds no model for it and writes an
empty line ({{BindyCsvFactory.unbind}}), with no error. For example, a Map of
field values that an earlier {{unmarshal: json}} gave, or a String.
{{bindyFixed}} does the same with a single Map ({{BindyFixedLengthDataFormat}},
lines 85-95), which bindyCsv and bindyKvp take as a record of class names. That
part was read from the code and not run.
Checked on 4.24.0-SNAPSHOT with {{camel run}}, with {{classType}} a
{{@CsvRecord}} class with the fields id and name:
* the model object: {{1,Camel}};
* the Map {{\{id=1, name=Camel\}}}: one empty line;
* the String {{1,Camel}}: two empty lines.
*Proposed change*: fail with an {{InvalidPayloadException}} when a body, or an
element of a List, is neither a model object nor a Map of model class names,
instead of writing an empty line.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)