camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Landicho (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-10110) Marshaling using CSV will insert escape char in header if using a pipe as separator
Date Fri, 01 Jul 2016 21:59:11 GMT

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

Tony Landicho edited comment on CAMEL-10110 at 7/1/16 9:58 PM:
---------------------------------------------------------------

Thanks for your response.

Below is my code, which is working for the most part, except for the "\" char in the header
columns.

-------------------------


import org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat;
...

public class From extends RouteBuilder  { 

  private String csvInputPath;
  private String csvOutputPath;

  public void configure() throws Exception { 

    
  BindyCsvDataFormat bindyFormat = new BindyCsvDataFormat( org.sample.model.MyMessage.class
);

    from(csvInputPath)
      .removeProperty(Exchange.CHARSET_NAME)
      .unmarshal(bindyFormat)
      .split(body())
      .to("direct:processMessage");

    from("direct:processMessage")
      .doTry()
      .process(new MyMessageProcessor())
      .to("direct:writeReport")
      .doCatch(Throwable.class)
      .to("direct:handleUnknownException")
      .end();


    from("direct:writeReport")
      .aggregate(constant(true), batchAggregationStrategy())
      .completionTimeout(BATCH_TIME_OUT)
      .marshal(bindyFormat)
      .to(csvOutputPath);

    ...

  }
}


was (Author: tlandich):
Thanks for your response.

Below is my code, which is working for the most part, except for the "\" char in the header
columns.

-------------------------


import org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat;
...

public class From extends RouteBuilder  { 

  private String csvInputPath;
  private String csvOutputPath;

  public void configure() throws Exception { 

    
  BindyCsvDataFormat bindyFormat = new BindyCsvDataFormat(org.sample.model.MyMessage.class);

    from(csvInputPath)
      .removeProperty(Exchange.CHARSET_NAME)
      .unmarshal(bindyFormat)
      .split(body())
      .to("direct:processMessage");

    from("direct:processMessage")
      .doTry()
      .process(new MyMessageProcessor())
      .to("direct:writeReport")
      .doCatch(Throwable.class)
      .to("direct:handleUnknownException")
      .end();


    from("direct:writeReport")
      .aggregate(constant(true), batchAggregationStrategy())
      .completionTimeout(BATCH_TIME_OUT)
      .marshal(bindyFormat)
      .to(csvOutputPath);

    ...

  }
}

> Marshaling using CSV will insert escape char in header if using a pipe as separator
> -----------------------------------------------------------------------------------
>
>                 Key: CAMEL-10110
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10110
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-bindy
>    Affects Versions: 2.15.2
>         Environment: Windows
>            Reporter: Tony Landicho
>            Priority: Minor
>
> This was an old bug that was supposedly resolved, but with version:2.15.2, the bug remains.
The escape characters are still added into the Header Columns when marshaling back the object.

> e.g. 
> Separator = \ \ |
> Output: 
> Header 1 \ | Header2 \ |...
> Pls. advise when we can expect the fix.
> Thanks.
> Reply



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message