I had a project using the Bindy for Camel 2.7.3 that has this code (with 87
fields about the same as the first one):

@CsvRecord(separator = "\t", crlf = "UNIX", generateHeaderColumns = false)
> public class CsvProduct {
>
> @DataField(pos = 1, required = false)
> private String EAN;


I updated my project to 2.9.1 and it still works fine for non-mandatory
fields.

Part of the route that is related:

> .convertBodyTo(String.class, "UTF-8").unmarshal().bindy(BindyType.Csv,
> "org.example.mypackage")
>



Den 27 mars 2012 09:58 skrev Aida <ai.d...@gmail.com>:

> 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?
>
>
> 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.
>

Reply via email to