camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-10853) CsvDataFormat should be completed with 'CSVFormat.withTrim'
Date Fri, 17 Feb 2017 16:04:41 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-10853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15872028#comment-15872028
] 

ASF GitHub Bot commented on CAMEL-10853:
----------------------------------------

GitHub user ribeaud opened a pull request:

    https://github.com/apache/camel/pull/1473

    [CAMEL-10853] Support 'ignoreHeaderCase', 'trim' and 'trailingDelimiter'

    The next time, I will need your formatter. I spent quite some time fixing **Checkstyle**
errors...
    And I still did not fix the EOL issue. But anyway, you're probably to review, reformat
the code anyway. Cheers, christian.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ribeaud/camel feature/CAMEL-10853

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1473.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1473
    
----
commit 9947591d1b6e1373b6248d1493ceebed2ef92dff
Author: Christian Ribeaud <christian@ribeaud.ch>
Date:   2017-02-17T15:58:21Z

    [CAMEL-10853] Support properties 'ignoreHeaderCase', 'trim' and
    'trailingDelimiter'.

----


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

Mime
View raw message