You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by James Carman <ja...@carmanconsulting.com> on 2012/09/21 18:27:32 UTC
JMS Header Binding Bug?
According to the documentation:
"The values must be primitives or their counter objects (such as
Integer, Long, Character). The types, String, CharSequence, Date,
BigDecimal and BigInteger are all converted to their toString()
representation. All other types are dropped."
So, it would seem that BigInteger should be toString()ed. However, in
the JmsBinding class, we see the following code:
protected Object getValidJMSHeaderValue(String headerName, Object headerValue) {
if (headerValue instanceof String) {
return headerValue;
} else if (headerValue instanceof Number) {
return headerValue;
} else if (headerValue instanceof Character) {
return headerValue;
} else if (headerValue instanceof CharSequence) {
return headerValue.toString();
} else if (headerValue instanceof Boolean) {
return headerValue;
} else if (headerValue instanceof Date) {
return headerValue.toString();
}
return null;
}
Since BigInteger extends Number, it will merely return the instance
itself. Does this contradict the documentation? It looks like this
value will be used to call setObjectProperty() on the JMS message
later.
Thanks,
James
Re: JMS Header Binding Bug?
Posted by James Carman <jc...@carmanconsulting.com>.
Created
https://issues.apache.org/jira/browse/CAMEL-5641
and patch attached.
On Sat, Sep 22, 2012 at 7:02 AM, James Carman
<jc...@carmanconsulting.com> wrote:
> Will do, with patch. Thanks!
>
> Sent from my iPad
>
> On Sep 22, 2012, at 2:51 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> On Fri, Sep 21, 2012 at 6:27 PM, James Carman
>> <ja...@carmanconsulting.com> wrote:
>>> According to the documentation:
>>>
>>> "The values must be primitives or their counter objects (such as
>>> Integer, Long, Character). The types, String, CharSequence, Date,
>>> BigDecimal and BigInteger are all converted to their toString()
>>> representation. All other types are dropped."
>>>
>>> So, it would seem that BigInteger should be toString()ed. However, in
>>> the JmsBinding class, we see the following code:
>>>
>>> protected Object getValidJMSHeaderValue(String headerName, Object headerValue) {
>>> if (headerValue instanceof String) {
>>> return headerValue;
>>> } else if (headerValue instanceof Number) {
>>> return headerValue;
>>> } else if (headerValue instanceof Character) {
>>> return headerValue;
>>> } else if (headerValue instanceof CharSequence) {
>>> return headerValue.toString();
>>> } else if (headerValue instanceof Boolean) {
>>> return headerValue;
>>> } else if (headerValue instanceof Date) {
>>> return headerValue.toString();
>>> }
>>> return null;
>>> }
>>>
>>> Since BigInteger extends Number, it will merely return the instance
>>> itself. Does this contradict the documentation? It looks like this
>>> value will be used to call setObjectProperty() on the JMS message
>>> later.
>>>
>>
>> Yes those 2 big should be explicit toString'ed. Fell free to create a
>> JIRA ticket and a patch.
>>
>>
>>> Thanks,
>>>
>>> James
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: cibsen@redhat.com
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
Re: JMS Header Binding Bug?
Posted by James Carman <jc...@carmanconsulting.com>.
Will do, with patch. Thanks!
Sent from my iPad
On Sep 22, 2012, at 2:51 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Fri, Sep 21, 2012 at 6:27 PM, James Carman
> <ja...@carmanconsulting.com> wrote:
>> According to the documentation:
>>
>> "The values must be primitives or their counter objects (such as
>> Integer, Long, Character). The types, String, CharSequence, Date,
>> BigDecimal and BigInteger are all converted to their toString()
>> representation. All other types are dropped."
>>
>> So, it would seem that BigInteger should be toString()ed. However, in
>> the JmsBinding class, we see the following code:
>>
>> protected Object getValidJMSHeaderValue(String headerName, Object headerValue) {
>> if (headerValue instanceof String) {
>> return headerValue;
>> } else if (headerValue instanceof Number) {
>> return headerValue;
>> } else if (headerValue instanceof Character) {
>> return headerValue;
>> } else if (headerValue instanceof CharSequence) {
>> return headerValue.toString();
>> } else if (headerValue instanceof Boolean) {
>> return headerValue;
>> } else if (headerValue instanceof Date) {
>> return headerValue.toString();
>> }
>> return null;
>> }
>>
>> Since BigInteger extends Number, it will merely return the instance
>> itself. Does this contradict the documentation? It looks like this
>> value will be used to call setObjectProperty() on the JMS message
>> later.
>>
>
> Yes those 2 big should be explicit toString'ed. Fell free to create a
> JIRA ticket and a patch.
>
>
>> Thanks,
>>
>> James
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
Re: JMS Header Binding Bug?
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Sep 21, 2012 at 6:27 PM, James Carman
<ja...@carmanconsulting.com> wrote:
> According to the documentation:
>
> "The values must be primitives or their counter objects (such as
> Integer, Long, Character). The types, String, CharSequence, Date,
> BigDecimal and BigInteger are all converted to their toString()
> representation. All other types are dropped."
>
> So, it would seem that BigInteger should be toString()ed. However, in
> the JmsBinding class, we see the following code:
>
> protected Object getValidJMSHeaderValue(String headerName, Object headerValue) {
> if (headerValue instanceof String) {
> return headerValue;
> } else if (headerValue instanceof Number) {
> return headerValue;
> } else if (headerValue instanceof Character) {
> return headerValue;
> } else if (headerValue instanceof CharSequence) {
> return headerValue.toString();
> } else if (headerValue instanceof Boolean) {
> return headerValue;
> } else if (headerValue instanceof Date) {
> return headerValue.toString();
> }
> return null;
> }
>
> Since BigInteger extends Number, it will merely return the instance
> itself. Does this contradict the documentation? It looks like this
> value will be used to call setObjectProperty() on the JMS message
> later.
>
Yes those 2 big should be explicit toString'ed. Fell free to create a
JIRA ticket and a patch.
> Thanks,
>
> James
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen