camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Ribeaud (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-10853) CsvDataFormat should be completed with 'CSVFormat.withTrim'
Date Fri, 17 Feb 2017 09:34:41 GMT
Christian Ribeaud created CAMEL-10853:
-----------------------------------------

             Summary: 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)

Mime
View raw message