You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by marcelk <ma...@gmail.com> on 2011/11/10 23:08:25 UTC

Bindy csv and generateHeaderColumns doesnt work with tabs

Hi,

I noticed that when using generateHeaderColumns the header generated doesnt
have the right seperator as in the content:

@CsvRecord(separator = "\\t", generateHeaderColumns=true, crlf="WINDOWS")

This produces:
orderNr\tfirstName
10	Marcel

I would expect the \t to be handled as tab.

So how can I fix this? Should I create a JIRA?

Thx, Marcel

--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-csv-and-generateHeaderColumns-doesnt-work-with-tabs-tp4982555p4982555.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Bindy csv and generateHeaderColumns doesnt work with tabs

Posted by marcelk <ma...@gmail.com>.
Hi Claus,

I dont have much time at the moment but I created a JUnit test and a patch.
I'll try to add things the right way later.

The patch I have is:
Index: src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
===================================================================
--- src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java       
(revision 1201023)
+++ src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java       
(working copy)
@@ -470,7 +470,8 @@

         Map<Integer, DataField> dataFieldsSorted = new TreeMap<Integer,
DataField>(dataFields);
         Iterator<Integer> it = dataFieldsSorted.keySet().iterator();
-
+        
+        char separator = Converter.getCharDelimitor(this.getSeparator());
         StringBuilder builderHeader = new StringBuilder();

         while (it.hasNext()) {


--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-csv-and-generateHeaderColumns-doesnt-work-with-tabs-tp4982555p4985495.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Bindy csv and generateHeaderColumns doesnt work with tabs

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Nov 10, 2011 at 11:08 PM, marcelk <ma...@gmail.com> wrote:
> Hi,
>
> I noticed that when using generateHeaderColumns the header generated doesnt
> have the right seperator as in the content:
>
> @CsvRecord(separator = "\\t", generateHeaderColumns=true, crlf="WINDOWS")
>
> This produces:
> orderNr\tfirstName
> 10      Marcel
>
> I would expect the \t to be handled as tab.
>
> So how can I fix this? Should I create a JIRA?
>

Yes please.

And we love contributions, so feel free to dive into the code.
http://camel.apache.org/contributing.html

> Thx, Marcel
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bindy-csv-and-generateHeaderColumns-doesnt-work-with-tabs-tp4982555p4982555.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Bindy csv and generateHeaderColumns doesnt work with tabs

Posted by marcelk <ma...@gmail.com>.
This is for the latest 2.8.2 version.

--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-csv-and-generateHeaderColumns-doesnt-work-with-tabs-tp4982555p4982563.html
Sent from the Camel Development mailing list archive at Nabble.com.