camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CAMEL-10853) CsvDataFormat should be completed with 'CSVFormat.withTrim'
Date Sat, 18 Feb 2017 09:33:44 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-10853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen resolved CAMEL-10853.
---------------------------------
    Resolution: Fixed

> 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
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.18.3, 2.19.0
>
>
> 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)

Mime
View raw message