You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "michal.warecki" <mi...@gmail.com> on 2012/02/26 21:17:55 UTC

ObjectConverter problem

Hi,

Reviewing tests I saw that in test
ExtractXPathWithNamespaceTest.testXPathWithNamespaceDifferentNamespace "foo"
is compared with 0 but I think when namespaces are different then xpath
should return null.

ObjectConverter.toInteger should return null for Double.NaN becouse 0 is the
same number as the other. I see no reasonable explanation for returning 0.

I've created patch for that if there are no contraindications.
http://pastebin.com/JUq4vYi0
http://pastebin.com/80qhjQcD

--
View this message in context: http://camel.465427.n5.nabble.com/ObjectConverter-problem-tp5517376p5517376.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: ObjectConverter problem

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi Claus!

Please take a look at my last comment [1] to see if it makes sense to you.

[1] https://issues.apache.org/jira/browse/CAMEL-4959

Babak

--
View this message in context: http://camel.465427.n5.nabble.com/ObjectConverter-problem-tp5517376p5521526.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: ObjectConverter problem

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

Yeah this is correct. I am adding a special check for NaN in the type
converter so we can deal with this situation.


On Sun, Feb 26, 2012 at 10:58 PM, michal.warecki
<mi...@gmail.com> wrote:
> Hmm, looks like more to work around the problem by changing the test instead
> of improving the code :-) There is no Integer equivalent to Double.NaN and
> Float.NaN so it seems more appropriate to me to return null value. It seems
> to me that this should be treated like the rest of the types that have no
> Integer equivalent.
>
> The case is currently implemented whenever xpath does not find value,
> returns 0 which is not correct.
>
> Cheers
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ObjectConverter-problem-tp5517376p5517571.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: ObjectConverter problem

Posted by "michal.warecki" <mi...@gmail.com>.
Hmm, looks like more to work around the problem by changing the test instead
of improving the code :-) There is no Integer equivalent to Double.NaN and
Float.NaN so it seems more appropriate to me to return null value. It seems
to me that this should be treated like the rest of the types that have no
Integer equivalent.

The case is currently implemented whenever xpath does not find value,
returns 0 which is not correct.

Cheers

--
View this message in context: http://camel.465427.n5.nabble.com/ObjectConverter-problem-tp5517376p5517571.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: ObjectConverter problem

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

Thanks for spotting this and indeed I do agree on this with you which IMHO
is a regression failure introduced by [1], but first let's see what
Christian's idea was [2] to change the unit-test instead of fixing
ObjectConverter itself.

[1] https://issues.apache.org/jira/browse/CAMEL-4959 
[2] http://svn.apache.org/viewvc?view=revision&revision=1293721

Babak

--
View this message in context: http://camel.465427.n5.nabble.com/ObjectConverter-problem-tp5517376p5517551.html
Sent from the Camel Development mailing list archive at Nabble.com.