camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Ribeaud (JIRA)" <>
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
             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:
CsvDataFormat dataFormat = new CsvDataFormat("\t") {

            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)
                CSVFormat format = csvDataFormat.getFormat();
                super.configureDataFormat(csvDataFormat, camelContext);

h4. Question
Are they other properties which should be considered?

This message was sent by Atlassian JIRA

View raw message