You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by apejavar <as...@gmail.com> on 2010/08/26 02:38:54 UTC
Bug in the BeanConverter class
I have a camel pipeline route that looks something like this:
{code}
<proxy id="someProxy"
serviceUrl="direct:someEndpoint"
serviceInterface="SomeInterface" />
<route>
<from uri="direct:someEndpoint"/>
<to uri="bean:someDecorator"/>
<to uri="activemqCore:queue:someQueue?transferException=true"/>
</route>
{code}
The decorator, someDecorator has the following method signature:
{code}
void decorate(final BaseClassOfSuper baseClass, final Message message);
{code}
Now if I use my proxy to send SuperClass I get a
NoTypeConversionAvailableException exception.
Looking at the org.apache.camel.component.bean.BeanConverter class, it has
(on line 51 of rel 2.4.0):
{code}
if (from.isAssignableFrom(type)) {
return body;
}
{code}
This should instead read:
{code}
if (type.isAssignableFrom(from)) {
return body;
}
{code}
because you always assign "from" to "type" and not vice versa.
- Ashwin
--
View this message in context: http://camel.465427.n5.nabble.com/Bug-in-the-BeanConverter-class-tp2653552p2653552.html
Sent from the Camel Development mailing list archive at Nabble.com.
Re: Bug in the BeanConverter class
Posted by Willem Jiang <wi...@gmail.com>.
I created JIRA[1] and committed the fix for it.
[1] https://issues.apache.org/activemq/browse/CAMEL-3082
Willem
Willem Jiang wrote:
> Hi Ashwin
>
> I just reproduced the error that you mentioned, I will commit a patch
> for it shortly.
>
> Willem
>
> apejavar wrote:
>> I have a camel pipeline route that looks something like this:
>>
>> {code}
>> <proxy id="someProxy"
>> serviceUrl="direct:someEndpoint"
>> serviceInterface="SomeInterface" />
>>
>> <route>
>> <from uri="direct:someEndpoint"/>
>> <to uri="bean:someDecorator"/>
>> <to uri="activemqCore:queue:someQueue?transferException=true"/>
>> </route>
>> {code}
>>
>> The decorator, someDecorator has the following method signature:
>>
>> {code}
>> void decorate(final BaseClassOfSuper baseClass, final Message message);
>> {code}
>>
>> Now if I use my proxy to send SuperClass I get a
>> NoTypeConversionAvailableException exception.
>>
>> Looking at the org.apache.camel.component.bean.BeanConverter class, it
>> has
>> (on line 51 of rel 2.4.0):
>>
>> {code}
>> if (from.isAssignableFrom(type)) {
>> return body;
>> }
>> {code}
>>
>> This should instead read:
>> {code}
>> if (type.isAssignableFrom(from)) {
>> return body;
>> }
>> {code}
>>
>> because you always assign "from" to "type" and not vice versa.
>>
>> - Ashwin
>>
>
>
Re: Bug in the BeanConverter class
Posted by Willem Jiang <wi...@gmail.com>.
Hi Ashwin
I just reproduced the error that you mentioned, I will commit a patch
for it shortly.
Willem
apejavar wrote:
> I have a camel pipeline route that looks something like this:
>
> {code}
> <proxy id="someProxy"
> serviceUrl="direct:someEndpoint"
> serviceInterface="SomeInterface" />
>
> <route>
> <from uri="direct:someEndpoint"/>
> <to uri="bean:someDecorator"/>
> <to uri="activemqCore:queue:someQueue?transferException=true"/>
> </route>
> {code}
>
> The decorator, someDecorator has the following method signature:
>
> {code}
> void decorate(final BaseClassOfSuper baseClass, final Message message);
> {code}
>
> Now if I use my proxy to send SuperClass I get a
> NoTypeConversionAvailableException exception.
>
> Looking at the org.apache.camel.component.bean.BeanConverter class, it has
> (on line 51 of rel 2.4.0):
>
> {code}
> if (from.isAssignableFrom(type)) {
> return body;
> }
> {code}
>
> This should instead read:
> {code}
> if (type.isAssignableFrom(from)) {
> return body;
> }
> {code}
>
> because you always assign "from" to "type" and not vice versa.
>
> - Ashwin
>