You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Aida <ai...@gmail.com> on 2012/03/27 09:58:05 UTC

[Bindy] Having trouble with the "required" field

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.

Re: [Bindy] Having trouble with the "required" field

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Mar 27, 2012 at 9:58 AM, Aida <ai...@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: 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] Having trouble with the "required" field

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Apr 17, 2012 at 11:25 AM, Aida <ai...@gmail.com> wrote:
> Hi,
>
> Thank you very much. I have seen that there is already a 2.9.3-SNAPSHOT in
> the repository, but I suppose that until the "final" release will be
> 1-2months, isn´t it?
> (my apologies in advance for being asking about releases all the time, we
> are using camel in a big project and the policy is trying to use the final
> releases when possible)
>

Yeah the fix will not be in 2.9.2. You would have to wait for 2.9.3 to
have the fix out of the box from Apache.

But since camel-bindy 2.9.3-SNAPSHOT is just like 2.9.2 + this fix,
you could just grab that snapshot JAR and then
rename it as 2.9.3 or override the 2.9.2 JAR version, and use that in
your project.

Another alternative is to talk to some of the commercial vendors if
you want an supported build to run in production.



> Thanks.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5646085.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: 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] Having trouble with the "required" field

Posted by Aida <ai...@gmail.com>.
Hi,

Thank you very much. I have seen that there is already a 2.9.3-SNAPSHOT in
the repository, but I suppose that until the "final" release will be
1-2months, isn´t it? 
(my apologies in advance for being asking about releases all the time, we
are using camel in a big project and the policy is trying to use the final
releases when possible)

Thanks.

--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5646085.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Bindy] Having trouble with the "required" field

Posted by Magnus Palmér <ma...@gmail.com>.
Looking at the release note for the 2.9.2 candidate the CAMEL-5018 is not
in the fixed bugs list.
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12311211&version=12320143

Den 16 april 2012 01:04 skrev Magnus Palmér <ma...@gmail.com>:

> According to Willem Jiang it is CAMEL-5018 that fixes this and when I
> check the 2.9.x branch that change doesn't seem to be in there.
>
> Den 11 april 2012 12:22 skrev Aida <ai...@gmail.com>:
>
> http://camel.465427.n5.nabble.com/file/n5632391/bindyTest.zipbindyTest.zip
>>
>> Here I attach my JUnit test and the BindyClass I'm using (is the same I
>> only
>> changed the name of the fields). The test case that fails is the last one
>> (is commented). I hope this to be enought (all this is in the context of a
>> bigger project and I can´t attach the full project).
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632391.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>

Re: [Bindy] Having trouble with the "required" field

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Thanks for the test cases. I found some time this morning. So I have
committed the tests to trunk and 2.9 branch.
And backported that CAMEL-5018 to 2.9 as well.

So this should be fixed in Camel 2.9.3. (missed the 2.9.2 release).


On Mon, Apr 16, 2012 at 3:36 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Do you mind open a new ticket.
> And then attach your modified unit test.
>
> Then we can apply the patch from CAMEL-5018 and add your unit  test.
>
>
>
> 2012/4/16 Magnus Palmér <ma...@gmail.com>:
>> Hmm, I had trouble with creating and applying patches, guess I have to
>> update my knowledge there of how to apply patches correctly.
>> Anyway, I merge this from trunk to my local 2.9.x branch instead:
>>
>> Revision: 1292164
>> Author: ningjiang
>> Date: den 22 februari 2012 08:49:40
>> Message:
>> CAMEL-5018 support the set the default value on the field of bindy CVS
>> ----
>> Modified :
>> /camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
>> Modified :
>> /camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java
>> Modified :
>> /camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
>> Modified :
>> /camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
>>
>> After that the merge my test run successfully. ( I had updated the tab test
>> case earlier, didn't get Aidas tests to compile on first two tries so I
>> used my own test case that I used when trying out this bug in 2.10).
>> (I first ran it before merge and it failed as expected.)
>>
>> Not sure how to proceed from here.
>> There is the Jira ticket that I opened earlier that Willem later set to
>> resolved since it is resolved in 2.10 (but not 2.9.x).
>>
>>
>> Den 16 april 2012 09:11 skrev Claus Ibsen <cl...@gmail.com>:
>>
>>> Hi
>>>
>>> I got side tracked by more important stuff I needed to attend.
>>> And well the Camel project has many committers to help also.
>>>
>>> Do you mind if you got spare time, to try the 2.9 branch and apply the
>>> patch(es) from CAMEL-5018.
>>> And try out the use-case from Aida to see if it fixes that?
>>>
>>> And it would be nice if a JIRA ticket was created. Then we can track this.
>>>
>>> 2012/4/16 Magnus Palmér <ma...@gmail.com>:
>>> > According to Willem Jiang it is CAMEL-5018 that fixes this and when I
>>> check
>>> > the 2.9.x branch that change doesn't seem to be in there.
>>> >
>>> > Den 11 april 2012 12:22 skrev Aida <ai...@gmail.com>:
>>> >
>>> >>
>>> http://camel.465427.n5.nabble.com/file/n5632391/bindyTest.zipbindyTest.zip
>>> >>
>>> >> Here I attach my JUnit test and the BindyClass I'm using (is the same I
>>> >> only
>>> >> changed the name of the fields). The test case that fails is the last
>>> one
>>> >> (is commented). I hope this to be enought (all this is in the context
>>> of a
>>> >> bigger project and I can´t attach the full project).
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632391.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: 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/
>>>
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> 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/



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
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] Having trouble with the "required" field

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Do you mind open a new ticket.
And then attach your modified unit test.

Then we can apply the patch from CAMEL-5018 and add your unit  test.



2012/4/16 Magnus Palmér <ma...@gmail.com>:
> Hmm, I had trouble with creating and applying patches, guess I have to
> update my knowledge there of how to apply patches correctly.
> Anyway, I merge this from trunk to my local 2.9.x branch instead:
>
> Revision: 1292164
> Author: ningjiang
> Date: den 22 februari 2012 08:49:40
> Message:
> CAMEL-5018 support the set the default value on the field of bindy CVS
> ----
> Modified :
> /camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
> Modified :
> /camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java
> Modified :
> /camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
> Modified :
> /camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
>
> After that the merge my test run successfully. ( I had updated the tab test
> case earlier, didn't get Aidas tests to compile on first two tries so I
> used my own test case that I used when trying out this bug in 2.10).
> (I first ran it before merge and it failed as expected.)
>
> Not sure how to proceed from here.
> There is the Jira ticket that I opened earlier that Willem later set to
> resolved since it is resolved in 2.10 (but not 2.9.x).
>
>
> Den 16 april 2012 09:11 skrev Claus Ibsen <cl...@gmail.com>:
>
>> Hi
>>
>> I got side tracked by more important stuff I needed to attend.
>> And well the Camel project has many committers to help also.
>>
>> Do you mind if you got spare time, to try the 2.9 branch and apply the
>> patch(es) from CAMEL-5018.
>> And try out the use-case from Aida to see if it fixes that?
>>
>> And it would be nice if a JIRA ticket was created. Then we can track this.
>>
>> 2012/4/16 Magnus Palmér <ma...@gmail.com>:
>> > According to Willem Jiang it is CAMEL-5018 that fixes this and when I
>> check
>> > the 2.9.x branch that change doesn't seem to be in there.
>> >
>> > Den 11 april 2012 12:22 skrev Aida <ai...@gmail.com>:
>> >
>> >>
>> http://camel.465427.n5.nabble.com/file/n5632391/bindyTest.zipbindyTest.zip
>> >>
>> >> Here I attach my JUnit test and the BindyClass I'm using (is the same I
>> >> only
>> >> changed the name of the fields). The test case that fails is the last
>> one
>> >> (is commented). I hope this to be enought (all this is in the context
>> of a
>> >> bigger project and I can´t attach the full project).
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632391.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: 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/
>>



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
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] Having trouble with the "required" field

Posted by Magnus Palmér <ma...@gmail.com>.
Hmm, I had trouble with creating and applying patches, guess I have to
update my knowledge there of how to apply patches correctly.
Anyway, I merge this from trunk to my local 2.9.x branch instead:

Revision: 1292164
Author: ningjiang
Date: den 22 februari 2012 08:49:40
Message:
CAMEL-5018 support the set the default value on the field of bindy CVS
----
Modified :
/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
Modified :
/camel/trunk/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java
Modified :
/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
Modified :
/camel/trunk/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java

After that the merge my test run successfully. ( I had updated the tab test
case earlier, didn't get Aidas tests to compile on first two tries so I
used my own test case that I used when trying out this bug in 2.10).
(I first ran it before merge and it failed as expected.)

Not sure how to proceed from here.
There is the Jira ticket that I opened earlier that Willem later set to
resolved since it is resolved in 2.10 (but not 2.9.x).


Den 16 april 2012 09:11 skrev Claus Ibsen <cl...@gmail.com>:

> Hi
>
> I got side tracked by more important stuff I needed to attend.
> And well the Camel project has many committers to help also.
>
> Do you mind if you got spare time, to try the 2.9 branch and apply the
> patch(es) from CAMEL-5018.
> And try out the use-case from Aida to see if it fixes that?
>
> And it would be nice if a JIRA ticket was created. Then we can track this.
>
> 2012/4/16 Magnus Palmér <ma...@gmail.com>:
> > According to Willem Jiang it is CAMEL-5018 that fixes this and when I
> check
> > the 2.9.x branch that change doesn't seem to be in there.
> >
> > Den 11 april 2012 12:22 skrev Aida <ai...@gmail.com>:
> >
> >>
> http://camel.465427.n5.nabble.com/file/n5632391/bindyTest.zipbindyTest.zip
> >>
> >> Here I attach my JUnit test and the BindyClass I'm using (is the same I
> >> only
> >> changed the name of the fields). The test case that fails is the last
> one
> >> (is commented). I hope this to be enought (all this is in the context
> of a
> >> bigger project and I can´t attach the full project).
> >>
> >> --
> >> View this message in context:
> >>
> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632391.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: 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] Having trouble with the "required" field

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I got side tracked by more important stuff I needed to attend.
And well the Camel project has many committers to help also.

Do you mind if you got spare time, to try the 2.9 branch and apply the
patch(es) from CAMEL-5018.
And try out the use-case from Aida to see if it fixes that?

And it would be nice if a JIRA ticket was created. Then we can track this.

2012/4/16 Magnus Palmér <ma...@gmail.com>:
> According to Willem Jiang it is CAMEL-5018 that fixes this and when I check
> the 2.9.x branch that change doesn't seem to be in there.
>
> Den 11 april 2012 12:22 skrev Aida <ai...@gmail.com>:
>
>> http://camel.465427.n5.nabble.com/file/n5632391/bindyTest.zipbindyTest.zip
>>
>> Here I attach my JUnit test and the BindyClass I'm using (is the same I
>> only
>> changed the name of the fields). The test case that fails is the last one
>> (is commented). I hope this to be enought (all this is in the context of a
>> bigger project and I can´t attach the full project).
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632391.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: 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] Having trouble with the "required" field

Posted by Magnus Palmér <ma...@gmail.com>.
According to Willem Jiang it is CAMEL-5018 that fixes this and when I check
the 2.9.x branch that change doesn't seem to be in there.

Den 11 april 2012 12:22 skrev Aida <ai...@gmail.com>:

> http://camel.465427.n5.nabble.com/file/n5632391/bindyTest.zipbindyTest.zip
>
> Here I attach my JUnit test and the BindyClass I'm using (is the same I
> only
> changed the name of the fields). The test case that fails is the last one
> (is commented). I hope this to be enought (all this is in the context of a
> bigger project and I can´t attach the full project).
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632391.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: [Bindy] Having trouble with the "required" field

Posted by Aida <ai...@gmail.com>.
http://camel.465427.n5.nabble.com/file/n5632391/bindyTest.zip bindyTest.zip 

Here I attach my JUnit test and the BindyClass I'm using (is the same I only
changed the name of the fields). The test case that fails is the last one
(is commented). I hope this to be enought (all this is in the context of a
bigger project and I can´t attach the full project).

--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632391.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Bindy] Having trouble with the "required" field

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Apr 11, 2012 at 10:54 AM, Aida <ai...@gmail.com> wrote:
> Hi again,
>
> I have tested it with both 2.9.2-SNAPSHOT and 2.10-SNAPSHOT. As magnuspalmer
> said, in the 2.10-SNAPSHOT works, but in the 2.9.2-SNAPSHOT the problem
> persists. So, is there any possibility that this issue can be resolved for
> 2.9.2?
>

Would it be possible for you to create a small example that fails on
2.9 and works on trunk.
At first glance the code in camel-bindy 2.9 and trunk has the same
patches. So the fix could be in camel-core itself.
So I would like an example to use to track this down.

Just an example as basic as you can create it, as few fields as possible etc.

Then we can added it as an unit test to help test against regressions
in the future.

> Thanks in advance.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632222.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: 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] Having trouble with the "required" field

Posted by Aida <ai...@gmail.com>.
Hi again,

I have tested it with both 2.9.2-SNAPSHOT and 2.10-SNAPSHOT. As magnuspalmer
said, in the 2.10-SNAPSHOT works, but in the 2.9.2-SNAPSHOT the problem
persists. So, is there any possibility that this issue can be resolved for
2.9.2?

Thanks in advance.

--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632222.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Bindy] Having trouble with the "required" field

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Apr 11, 2012 at 9:42 AM, Aida <ai...@gmail.com> wrote:
>
> Ok, thank you very much.
>
> I have read in other jira ticket that the 2.10 release was planned to be
> available in a near future, do you think it will be published soon? (I ask
> to know if I should use the snapshot in my project or if I can wait for the
> new release)
>

Have you tried 2.9.2 SNAPSHOT. As we are closing in on a new 2.9.2
release this month.
Possible cutting the release as soon as in this week.

We may be able to find the changes on trunk that fixed this and
backport it to 2.9, if its still a problem.


> Thanks again.
>
>  Aida.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632049.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: 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] Having trouble with the "required" field

Posted by Aida <ai...@gmail.com>.
Ok, thank you very much.

I have read in other jira ticket that the 2.10 release was planned to be
available in a near future, do you think it will be published soon? (I ask
to know if I should use the snapshot in my project or if I can wait for the
new release)

Thanks again.

  Aida.

--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5632049.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Bindy] Having trouble with the "required" field

Posted by Magnus Palmér <ma...@gmail.com>.
Hmm, I had a hard time recreating the issue when trying to extend the
current JUnit test.
Turns out that it already works in 2.10-SNAPSHOT.
Uncertain when and how, still trying to figure it out since it does seem to
be a side effect of some other change.


Den 31 mars 2012 13:18 skrev Magnus Palmér <ma...@gmail.com>:

> JIRA ticket created:
> https://issues.apache.org/jira/browse/CAMEL-5133
>
>
> Den 31 mars 2012 12:56 skrev Magnus Palmér <ma...@gmail.com>:
>
> Sure, I can create a JIRA ticket for it.
>> Will have to set up my dev-environment properly to be able to patch it
>> though.
>> It is in my plan to do anyway but since I am on paternity leave it will
>> take a few days since I only have a few hours every day to stuff like this.
>> I will migrate a legacy integration platform from in-house framework to
>> Camel so I will finally get to spend a lot more time to get familiar with
>> the details of Camel.
>>
>> Anyway, not sure how to patch it.
>>
>> The problem occurs only when separator is considered a whitespace
>> character.
>> Could be tested via Character.isWhitespace(separator)
>> The other way around is to remove the trim(), I don't see the point in
>> trimming the read line, but then I could jeopardize working code.
>> Or maybe only trim if Character.isWhitespace(separator) == false?
>>
>> Perhaps such questions is better placed on the dev-list (not subscribing
>> to that one yet)?
>>
>> Kind regards, Magnus
>>
>>
>> Den 31 mars 2012 12:05 skrev Claus Ibsen <cl...@gmail.com>:
>>
>> 2012/3/29 Magnus Palmér <ma...@gmail.com>:
>>> > I can confirm, I get the same error as you do when I remove the two
>>> last
>>> > fields at the end of the line as you did.
>>> >
>>> > I think this is the where it starts to get wrong:
>>> > BindyCsvDataFormat.java
>>> >
>>> >  138               // Read the line
>>> >  139              String line = scanner.nextLine().trim();
>>> >
>>> > String.trim() trims all the remaining tabs...
>>> >
>>>
>>> Well spotted. Do you mind created a JIRA ticket? And patches is welcome.
>>>
>>>
>>> > Den 29 mars 2012 11:17 skrev Aida <ai...@gmail.com>:
>>> >
>>> >> Hi again, thank you for the quick answers.
>>> >>
>>> >> I think I have been able to replicate the problem in an easy way. I
>>> have
>>> >> built some test cases and I have found the one in which I'm having
>>> trouble.
>>> >> The "required=false" option is working for me always except in one
>>> case.
>>> >>
>>> >> This case is when the two missing fields occur at the end of a line
>>> at the
>>> >> same time. I'm going to explain it with my test cases.
>>> >>
>>> >> I have built a simple route for my unitary tests:
>>> >>
>>> >> from(URI_START_PROCESS)
>>> >>      .unmarshal().bindy(BindyType.Csv, "com.mypackage")
>>> >>              .to(URI_END_PROCESS_MOCK);
>>> >>
>>> >>
>>> >> My class (I have only one) in "com.mypackage" has the following
>>> >> annotations:
>>> >> @CsvRecord(separator="\t")
>>> >> from positions 1 to 5: @DataField(pos = N, required = true)
>>> >> for positions 6 and 7 : @DataField(pos = N, required = false)  (so
>>> fields 6
>>> >> and 7 are optional)
>>> >>
>>> >> Test Cases:
>>> >>
>>> >> Case 1: Processing two lines with ALL the fields    (Works like a
>>> charm)
>>> >> String data2Process = "data1\t14700\t2011-10-04
>>> >> 04:00\t5\t1\t5\t9\ndata2\t14700\t2011-10-04 05:00\t49\t2\t5";
>>> >>
>>> >> Case 2: Processing two lines. In the first line the 6th field is
>>> missing
>>> >> (works perfectly)
>>> >> String data2Process = "data1\t14700\t2011-10-04
>>> >> 04:00\t5\t0*\t\t*0\ndata2\t14700\t2011-10-04 05:00\t149\t0\t0";
>>> >>
>>> >> Case 3: Processing two lines. In the first line the 7th field is
>>> missing
>>> >> (works perfectly)
>>> >> String data2Process = "data1\t14700\t2011-10-04
>>> >> 04:00\t5\t0\t0*\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
>>> >>
>>> >> Case 4: Processing two lines. In the first line, both 6th and 7th
>>> field are
>>> >> missing (is not working)
>>> >> String data2Process = "data1\t14700\t2011-10-04
>>> >> 04:00\t5\t0*\t\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
>>> >>
>>> >>
>>> >> I also tried a variation of Case 4, in which I made field 5 also not
>>> >> required and the missing fields were 5th and 6th, in this case there
>>> were
>>> >> no
>>> >> problems.
>>> >>
>>> >> The exception is the one I said before: "Some fields are missing
>>> (optional
>>> >> or mandatory), line:1"
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5603131.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: 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] Having trouble with the "required" field

Posted by Magnus Palmér <ma...@gmail.com>.
JIRA ticket created:
https://issues.apache.org/jira/browse/CAMEL-5133


Den 31 mars 2012 12:56 skrev Magnus Palmér <ma...@gmail.com>:

> Sure, I can create a JIRA ticket for it.
> Will have to set up my dev-environment properly to be able to patch it
> though.
> It is in my plan to do anyway but since I am on paternity leave it will
> take a few days since I only have a few hours every day to stuff like this.
> I will migrate a legacy integration platform from in-house framework to
> Camel so I will finally get to spend a lot more time to get familiar with
> the details of Camel.
>
> Anyway, not sure how to patch it.
>
> The problem occurs only when separator is considered a whitespace
> character.
> Could be tested via Character.isWhitespace(separator)
> The other way around is to remove the trim(), I don't see the point in
> trimming the read line, but then I could jeopardize working code.
> Or maybe only trim if Character.isWhitespace(separator) == false?
>
> Perhaps such questions is better placed on the dev-list (not subscribing
> to that one yet)?
>
> Kind regards, Magnus
>
>
> Den 31 mars 2012 12:05 skrev Claus Ibsen <cl...@gmail.com>:
>
> 2012/3/29 Magnus Palmér <ma...@gmail.com>:
>> > I can confirm, I get the same error as you do when I remove the two last
>> > fields at the end of the line as you did.
>> >
>> > I think this is the where it starts to get wrong:
>> > BindyCsvDataFormat.java
>> >
>> >  138               // Read the line
>> >  139              String line = scanner.nextLine().trim();
>> >
>> > String.trim() trims all the remaining tabs...
>> >
>>
>> Well spotted. Do you mind created a JIRA ticket? And patches is welcome.
>>
>>
>> > Den 29 mars 2012 11:17 skrev Aida <ai...@gmail.com>:
>> >
>> >> Hi again, thank you for the quick answers.
>> >>
>> >> I think I have been able to replicate the problem in an easy way. I
>> have
>> >> built some test cases and I have found the one in which I'm having
>> trouble.
>> >> The "required=false" option is working for me always except in one
>> case.
>> >>
>> >> This case is when the two missing fields occur at the end of a line at
>> the
>> >> same time. I'm going to explain it with my test cases.
>> >>
>> >> I have built a simple route for my unitary tests:
>> >>
>> >> from(URI_START_PROCESS)
>> >>      .unmarshal().bindy(BindyType.Csv, "com.mypackage")
>> >>              .to(URI_END_PROCESS_MOCK);
>> >>
>> >>
>> >> My class (I have only one) in "com.mypackage" has the following
>> >> annotations:
>> >> @CsvRecord(separator="\t")
>> >> from positions 1 to 5: @DataField(pos = N, required = true)
>> >> for positions 6 and 7 : @DataField(pos = N, required = false)  (so
>> fields 6
>> >> and 7 are optional)
>> >>
>> >> Test Cases:
>> >>
>> >> Case 1: Processing two lines with ALL the fields    (Works like a
>> charm)
>> >> String data2Process = "data1\t14700\t2011-10-04
>> >> 04:00\t5\t1\t5\t9\ndata2\t14700\t2011-10-04 05:00\t49\t2\t5";
>> >>
>> >> Case 2: Processing two lines. In the first line the 6th field is
>> missing
>> >> (works perfectly)
>> >> String data2Process = "data1\t14700\t2011-10-04
>> >> 04:00\t5\t0*\t\t*0\ndata2\t14700\t2011-10-04 05:00\t149\t0\t0";
>> >>
>> >> Case 3: Processing two lines. In the first line the 7th field is
>> missing
>> >> (works perfectly)
>> >> String data2Process = "data1\t14700\t2011-10-04
>> >> 04:00\t5\t0\t0*\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
>> >>
>> >> Case 4: Processing two lines. In the first line, both 6th and 7th
>> field are
>> >> missing (is not working)
>> >> String data2Process = "data1\t14700\t2011-10-04
>> >> 04:00\t5\t0*\t\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
>> >>
>> >>
>> >> I also tried a variation of Case 4, in which I made field 5 also not
>> >> required and the missing fields were 5th and 6th, in this case there
>> were
>> >> no
>> >> problems.
>> >>
>> >> The exception is the one I said before: "Some fields are missing
>> (optional
>> >> or mandatory), line:1"
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5603131.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: 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] Having trouble with the "required" field

Posted by Magnus Palmér <ma...@gmail.com>.
Sure, I can create a JIRA ticket for it.
Will have to set up my dev-environment properly to be able to patch it
though.
It is in my plan to do anyway but since I am on paternity leave it will
take a few days since I only have a few hours every day to stuff like this.
I will migrate a legacy integration platform from in-house framework to
Camel so I will finally get to spend a lot more time to get familiar with
the details of Camel.

Anyway, not sure how to patch it.

The problem occurs only when separator is considered a whitespace character.
Could be tested via Character.isWhitespace(separator)
The other way around is to remove the trim(), I don't see the point in
trimming the read line, but then I could jeopardize working code.
Or maybe only trim if Character.isWhitespace(separator) == false?

Perhaps such questions is better placed on the dev-list (not subscribing to
that one yet)?

Kind regards, Magnus


Den 31 mars 2012 12:05 skrev Claus Ibsen <cl...@gmail.com>:

> 2012/3/29 Magnus Palmér <ma...@gmail.com>:
> > I can confirm, I get the same error as you do when I remove the two last
> > fields at the end of the line as you did.
> >
> > I think this is the where it starts to get wrong:
> > BindyCsvDataFormat.java
> >
> >  138               // Read the line
> >  139              String line = scanner.nextLine().trim();
> >
> > String.trim() trims all the remaining tabs...
> >
>
> Well spotted. Do you mind created a JIRA ticket? And patches is welcome.
>
>
> > Den 29 mars 2012 11:17 skrev Aida <ai...@gmail.com>:
> >
> >> Hi again, thank you for the quick answers.
> >>
> >> I think I have been able to replicate the problem in an easy way. I have
> >> built some test cases and I have found the one in which I'm having
> trouble.
> >> The "required=false" option is working for me always except in one case.
> >>
> >> This case is when the two missing fields occur at the end of a line at
> the
> >> same time. I'm going to explain it with my test cases.
> >>
> >> I have built a simple route for my unitary tests:
> >>
> >> from(URI_START_PROCESS)
> >>      .unmarshal().bindy(BindyType.Csv, "com.mypackage")
> >>              .to(URI_END_PROCESS_MOCK);
> >>
> >>
> >> My class (I have only one) in "com.mypackage" has the following
> >> annotations:
> >> @CsvRecord(separator="\t")
> >> from positions 1 to 5: @DataField(pos = N, required = true)
> >> for positions 6 and 7 : @DataField(pos = N, required = false)  (so
> fields 6
> >> and 7 are optional)
> >>
> >> Test Cases:
> >>
> >> Case 1: Processing two lines with ALL the fields    (Works like a charm)
> >> String data2Process = "data1\t14700\t2011-10-04
> >> 04:00\t5\t1\t5\t9\ndata2\t14700\t2011-10-04 05:00\t49\t2\t5";
> >>
> >> Case 2: Processing two lines. In the first line the 6th field is missing
> >> (works perfectly)
> >> String data2Process = "data1\t14700\t2011-10-04
> >> 04:00\t5\t0*\t\t*0\ndata2\t14700\t2011-10-04 05:00\t149\t0\t0";
> >>
> >> Case 3: Processing two lines. In the first line the 7th field is missing
> >> (works perfectly)
> >> String data2Process = "data1\t14700\t2011-10-04
> >> 04:00\t5\t0\t0*\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
> >>
> >> Case 4: Processing two lines. In the first line, both 6th and 7th field
> are
> >> missing (is not working)
> >> String data2Process = "data1\t14700\t2011-10-04
> >> 04:00\t5\t0*\t\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
> >>
> >>
> >> I also tried a variation of Case 4, in which I made field 5 also not
> >> required and the missing fields were 5th and 6th, in this case there
> were
> >> no
> >> problems.
> >>
> >> The exception is the one I said before: "Some fields are missing
> (optional
> >> or mandatory), line:1"
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5603131.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: 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] Having trouble with the "required" field

Posted by Claus Ibsen <cl...@gmail.com>.
2012/3/29 Magnus Palmér <ma...@gmail.com>:
> I can confirm, I get the same error as you do when I remove the two last
> fields at the end of the line as you did.
>
> I think this is the where it starts to get wrong:
> BindyCsvDataFormat.java
>
>  138               // Read the line
>  139              String line = scanner.nextLine().trim();
>
> String.trim() trims all the remaining tabs...
>

Well spotted. Do you mind created a JIRA ticket? And patches is welcome.


> Den 29 mars 2012 11:17 skrev Aida <ai...@gmail.com>:
>
>> Hi again, thank you for the quick answers.
>>
>> I think I have been able to replicate the problem in an easy way. I have
>> built some test cases and I have found the one in which I'm having trouble.
>> The "required=false" option is working for me always except in one case.
>>
>> This case is when the two missing fields occur at the end of a line at the
>> same time. I'm going to explain it with my test cases.
>>
>> I have built a simple route for my unitary tests:
>>
>> from(URI_START_PROCESS)
>>      .unmarshal().bindy(BindyType.Csv, "com.mypackage")
>>              .to(URI_END_PROCESS_MOCK);
>>
>>
>> My class (I have only one) in "com.mypackage" has the following
>> annotations:
>> @CsvRecord(separator="\t")
>> from positions 1 to 5: @DataField(pos = N, required = true)
>> for positions 6 and 7 : @DataField(pos = N, required = false)  (so fields 6
>> and 7 are optional)
>>
>> Test Cases:
>>
>> Case 1: Processing two lines with ALL the fields    (Works like a charm)
>> String data2Process = "data1\t14700\t2011-10-04
>> 04:00\t5\t1\t5\t9\ndata2\t14700\t2011-10-04 05:00\t49\t2\t5";
>>
>> Case 2: Processing two lines. In the first line the 6th field is missing
>> (works perfectly)
>> String data2Process = "data1\t14700\t2011-10-04
>> 04:00\t5\t0*\t\t*0\ndata2\t14700\t2011-10-04 05:00\t149\t0\t0";
>>
>> Case 3: Processing two lines. In the first line the 7th field is missing
>> (works perfectly)
>> String data2Process = "data1\t14700\t2011-10-04
>> 04:00\t5\t0\t0*\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
>>
>> Case 4: Processing two lines. In the first line, both 6th and 7th field are
>> missing (is not working)
>> String data2Process = "data1\t14700\t2011-10-04
>> 04:00\t5\t0*\t\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
>>
>>
>> I also tried a variation of Case 4, in which I made field 5 also not
>> required and the missing fields were 5th and 6th, in this case there were
>> no
>> problems.
>>
>> The exception is the one I said before: "Some fields are missing (optional
>> or mandatory), line:1"
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5603131.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: 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] Having trouble with the "required" field

Posted by Magnus Palmér <ma...@gmail.com>.
I can confirm, I get the same error as you do when I remove the two last
fields at the end of the line as you did.

I think this is the where it starts to get wrong:
BindyCsvDataFormat.java

 138               // Read the line
 139              String line = scanner.nextLine().trim();

String.trim() trims all the remaining tabs...

Den 29 mars 2012 11:17 skrev Aida <ai...@gmail.com>:

> Hi again, thank you for the quick answers.
>
> I think I have been able to replicate the problem in an easy way. I have
> built some test cases and I have found the one in which I'm having trouble.
> The "required=false" option is working for me always except in one case.
>
> This case is when the two missing fields occur at the end of a line at the
> same time. I'm going to explain it with my test cases.
>
> I have built a simple route for my unitary tests:
>
> from(URI_START_PROCESS)
>      .unmarshal().bindy(BindyType.Csv, "com.mypackage")
>              .to(URI_END_PROCESS_MOCK);
>
>
> My class (I have only one) in "com.mypackage" has the following
> annotations:
> @CsvRecord(separator="\t")
> from positions 1 to 5: @DataField(pos = N, required = true)
> for positions 6 and 7 : @DataField(pos = N, required = false)  (so fields 6
> and 7 are optional)
>
> Test Cases:
>
> Case 1: Processing two lines with ALL the fields    (Works like a charm)
> String data2Process = "data1\t14700\t2011-10-04
> 04:00\t5\t1\t5\t9\ndata2\t14700\t2011-10-04 05:00\t49\t2\t5";
>
> Case 2: Processing two lines. In the first line the 6th field is missing
> (works perfectly)
> String data2Process = "data1\t14700\t2011-10-04
> 04:00\t5\t0*\t\t*0\ndata2\t14700\t2011-10-04 05:00\t149\t0\t0";
>
> Case 3: Processing two lines. In the first line the 7th field is missing
> (works perfectly)
> String data2Process = "data1\t14700\t2011-10-04
> 04:00\t5\t0\t0*\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
>
> Case 4: Processing two lines. In the first line, both 6th and 7th field are
> missing (is not working)
> String data2Process = "data1\t14700\t2011-10-04
> 04:00\t5\t0*\t\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";
>
>
> I also tried a variation of Case 4, in which I made field 5 also not
> required and the missing fields were 5th and 6th, in this case there were
> no
> problems.
>
> The exception is the one I said before: "Some fields are missing (optional
> or mandatory), line:1"
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5603131.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: [Bindy] Having trouble with the "required" field

Posted by Aida <ai...@gmail.com>.
Hi again, thank you for the quick answers.

I think I have been able to replicate the problem in an easy way. I have
built some test cases and I have found the one in which I'm having trouble.
The "required=false" option is working for me always except in one case.

This case is when the two missing fields occur at the end of a line at the
same time. I'm going to explain it with my test cases.

I have built a simple route for my unitary tests:

from(URI_START_PROCESS)	
      .unmarshal().bindy(BindyType.Csv, "com.mypackage")
	      .to(URI_END_PROCESS_MOCK);


My class (I have only one) in "com.mypackage" has the following annotations:
@CsvRecord(separator="\t")
from positions 1 to 5: @DataField(pos = N, required = true)
for positions 6 and 7 : @DataField(pos = N, required = false)  (so fields 6
and 7 are optional)

Test Cases:

Case 1: Processing two lines with ALL the fields    (Works like a charm)
String data2Process = "data1\t14700\t2011-10-04
04:00\t5\t1\t5\t9\ndata2\t14700\t2011-10-04 05:00\t49\t2\t5";

Case 2: Processing two lines. In the first line the 6th field is missing
(works perfectly)
String data2Process = "data1\t14700\t2011-10-04
04:00\t5\t0*\t\t*0\ndata2\t14700\t2011-10-04 05:00\t149\t0\t0";

Case 3: Processing two lines. In the first line the 7th field is missing
(works perfectly)
String data2Process = "data1\t14700\t2011-10-04
04:00\t5\t0\t0*\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";

Case 4: Processing two lines. In the first line, both 6th and 7th field are
missing (is not working)
String data2Process = "data1\t14700\t2011-10-04
04:00\t5\t0*\t\t\n*data2\t14700\t2011-10-04 05:00\t149\t0\t0";


I also tried a variation of Case 4, in which I made field 5 also not
required and the missing fields were 5th and 6th, in this case there were no
problems. 

The exception is the one I said before: "Some fields are missing (optional
or mandatory), line:1"



--
View this message in context: http://camel.465427.n5.nabble.com/Bindy-Having-trouble-with-the-required-field-tp5597196p5603131.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: [Bindy] Having trouble with the "required" field

Posted by Magnus Palmér <ma...@gmail.com>.
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...@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.
>