[
https://issues.apache.org/jira/browse/CAMEL-10853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15871918#comment-15871918
]
Christian Ribeaud commented on CAMEL-10853:
-------------------------------------------
Identified following candidates: _ignoreHeaderCase_, _trim_ and
_trailingDelimiter_. I will make a pull request.
> CsvDataFormat should be completed with 'CSVFormat.withTrim'
> -----------------------------------------------------------
>
> Key: CAMEL-10853
> URL: https://issues.apache.org/jira/browse/CAMEL-10853
> Project: Camel
> Issue Type: Improvement
> Components: camel-csv
> Affects Versions: 2.18.1
> Reporter: Christian Ribeaud
> Priority: Minor
>
> In *Camel* {{org.apache.commons.csv.CSVFormat}} is indirectly configured via
> {{org.apache.camel.model.dataformat.CsvDataFormat}}. Although it is possible
> to tell {{CSVFormat}} to trim leading and trailing blanks via
> {{CSVFormat.withTrim}}, this property can NOT be set in {{CsvDataFormat}}.
> h4. Workaround
> As a workaround, one could do the following:
> {code:java}
> CsvDataFormat dataFormat = new CsvDataFormat("\t") {
> @Override
> protected void configureDataFormat(DataFormat dataFormat,
> CamelContext camelContext) {
> // This is how we force the engine to trim the values
> org.apache.camel.dataformat.csv.CsvDataFormat csvDataFormat =
> (org.apache.camel.dataformat.csv.CsvDataFormat) dataFormat;
> CSVFormat format = csvDataFormat.getFormat();
> csvDataFormat.setFormat(format.withTrim());
> super.configureDataFormat(csvDataFormat, camelContext);
> }
> };
> {code}
> h4. Question
> Are they other properties which should be considered?
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)