Federico Mariani created CAMEL-26975:
----------------------------------------
Summary: camel-csv: an empty header marshals Map rows as empty
lines
Key: CAMEL-26975
URL: https://issues.apache.org/jira/browse/CAMEL-26975
Project: Camel
Issue Type: Bug
Components: camel-csv
Affects Versions: 4.18.5, 4.23.0, 4.22.2
Reporter: Federico Mariani
Fix For: 4.24.0, 4.22.3, 4.18.6
An empty {{header}} is taken as one fixed column named {{""}}, so a Map row is
marshalled as a quoted empty header line followed by an empty line: the values
are lost.
{code:java}
from("direct:start").to("dataformat:csv:marshal?header=");
// or: .marshal(new CsvDataFormat().setHeader(""))
// body Map {foo=abc, bar=123} gives "\"\"\r\n\r\n"
{code}
Expected: an empty or blank header is handled like no header (as the
{{setHeader}} Javadoc says and CAMEL-17767 fixed), so the row is written as
{{abc,123}}.
Regression since 4.10.1/4.11.0: CAMEL-21734 (commit 7c8ba2ba9e60) takes the
columns from the format header, which {{getActiveFormat}} sets to {{[""]}}, and
dropped the empty check of CAMEL-17767.
_Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)