camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem jiang <willem.ji...@gmail.com>
Subject Re: @CsvRecord reject
Date Tue, 05 Mar 2013 03:47:30 GMT
Can you double check the AED toString method?
I tried to write some unit test, but I could not reproduce the error that you got.

BTW, which version of Camel are  you using?
Did you try it with latest release Camel 2.10.4 ?


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Tuesday, March 5, 2013 at 1:09 AM, Jean Francois LE BESCONT wrote:

> Hey !  
>  
> I would like to bind a CSV content. But camel looks to do strange things.
>  
> My File : VDE_AED.csv is a simple UNIX file :  
>  
> bob;mazone4;01/12/2012;jack
> bob;mazone5;01/12/2012?;jack
> bob;mazone4;01/12/2012;jack
>  
> ( the second line has to be rejected)
>  
> I have a CSV Record :  
>  
> @CsvRecord(separator = ";" , crlf = "UNIX" )
> public class AED {
>  
> @DataField(pos = 1, required = true)
> private String nom = "";
>  
> @DataField(pos = 2, required = true)  
> private String zone = "";
>  
> @DataField(pos = 3, pattern = "dd/MM/yyyy", required = true)  
> private Date date = null;
>  
> @DataField(pos = 4, required = true)
> private String titulaire = "";
> [... get set tostring ]
>  
> And a simpliest route :  
>  
>  
>  
> errorHandler(deadLetterChannel("direct:error"));  
>  
> from("file://C:/Temp/camel?noop=true")
> .log("Ticket : ${body}")
> .split()
> .tokenize("\n")
> .unmarshal()
> .bindy(BindyType.Csv, AED.class)
> .log("Ticket in : ${body}")
> .marshal()
> .bindy(BindyType.Csv, AED.class)
> .log("end ${file:name}").end();
>  
>  
> from("direct:error").log("ERROR : '${body}' ").end();
>  
>  
>  
> - All my line are rejected when required = true for the first column :  
>  
> @DataField(pos = 1, required = true)
> private String nom = "";
>  
> - When @DataField(pos = 1, required = false)  
> private String nom = "";
>  
>  
>  
> Correct line are bindy except the first column which stay null.
>  
>  
> [read #5 - file://C:/Temp/camel] route1 INFO Ticket : bob;mazone4;01/12/2012;jack
> bob;mazone5;01/12/2012?;jack
> bob;mazone4;01/12/2012;jack
>  
> [read #5 - file://C:/Temp/camel] route1 INFO Ticket in : Descripteur [nom=, zone=mazone4,
date=Sat Dec 01 00:00:00 CET 2012, titulaire=jack]
> [read #5 - file://C:/Temp/camel] route1 INFO Fin traitement VDE_AED.csv
> [read #5 - file://C:/Temp/camel] route2 INFO ERROR : 'bob;mazone5;01/12/2012?;jack' 

> [read #5 - file://C:/Temp/camel] route1 INFO Ticket in : Descripteur [nom=, zone=mazone4,
date=Sat Dec 01 00:00:00 CET 2012, titulaire=jack]
> [read #5 - file://C:/Temp/camel] route1 INFO Fin traitement VDE_AED.csv
>  
>  
>  
>  
> By the way I am using camel 2.10.3
>  
> Strange isn't it ?  
>  
>  
> Attachments:  
> - VDE_AED.csv
>  
>  




Mime
View raw message