You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2017/02/17 11:08:41 UTC
[jira] [Commented] (CAMEL-10853) CsvDataFormat should be completed
with 'CSVFormat.withTrim'
[ https://issues.apache.org/jira/browse/CAMEL-10853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15871681#comment-15871681 ]
Claus Ibsen commented on CAMEL-10853:
-------------------------------------
Yeah try to take a look and see if you can spot other options
> 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, on 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)