On Tue, Mar 27, 2012 at 9:58 AM, Aida <ai.d...@gmail.com> wrote: > Hi, > > I'm using bindy for parsing files, but I'm having problems with the > "required" option (by default set to false). > > Camel version: 2.9.1 > kind of file being processed: csv > separator : \t > number of classes (for map from file to object): only 1 > > My problem comes when I try to process a file with missing fields. For > example if it processes ok a line like this: > > DATA1\tDATA2\tDATA3\n > > Processing the following line throws an exception, even though the fields > are not required: > > DATA1\t\t\n > > I have tried also putting blankspaces " " instead of the data, and writing > explicity the required=false option in each DataField. > > > Maybe I'm missing something stupid or I'm not understanding the usage of > that option correctly, but I have built an unitary test and tried with some > combinations with no results. > > The message of the error is : "Some fields are missing (optional or > mandatory)" what makes me think that optional fields maybe must have also > data in the file, could it be? >
As camel-bindy uses regular exp during parsing it may be also tricky with your \t separator. You may have to escape that as \\t. Anyway I suggest just for a simple test with a single line of data to try with a semi colon or comma as a separator. And then see if it then works. If so then its the \t separator that plays tricks. And you would need to escape that. And if its still a problem then, let us know and we can try to reproduce the issue and see if a fix is needed in the source code. > > Thanks in advance. > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5597196.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/