You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dmitriyC300 <dm...@gmail.com> on 2016/10/12 14:28:38 UTC

ognl issue w/ list expression & spring boot?

It appears that there may be a conflict running simple expression w/ List
under spring boot.  SpringTypeConverter is registered as a fallback
converter which gets picked up during ognl while attempting to convert list
-> map causing an exception instead of a null response that is expected.  It
is happening under 2.17 & 2.18.  Let me know if I should submit a jira
ticket or if I am missing something here.

sample expression: ${body.list[0].field}

10:20:32.499 [main] TRACE o.a.c.i.c.DefaultTypeConverter | Converting
java.util.ArrayList -> java.util.Map 
10:20:32.500 [main] TRACE o.a.c.i.c.DefaultTypeConverter | Using converter:
org.apache.camel.impl.converter.ArrayTypeConverter@79d7035 to convert [class
java.util.ArrayList=>interface java.util.Map]


Caused by: org.apache.camel.TypeConversionException: Error during type
conversion from type: java.util.ArrayList to the required type:
java.util.Map with due Failed to convert from type [java.util.ArrayList<?>]
to type [java.util.Map<?, ?>]
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:121)
	at
org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.lookupResult(BeanExpression.java:358)
	at
org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:334)
	at
org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)
	... 55 common frames omitted
Caused by: org.springframework.core.convert.ConversionFailedException:
Failed to convert from type [java.util.ArrayList<?>] to type
[java.util.Map<?, ?>] 
	at
org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:42)
	at
org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192)
	at
org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176)
	at
org.apache.camel.spring.boot.SpringTypeConverter.convertTo(SpringTypeConverter.java:46)
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:346)
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:133)
	... 59 common frames omitted

Dmitriy



--
View this message in context: http://camel.465427.n5.nabble.com/ognl-issue-w-list-expression-spring-boot-tp5788692.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ognl issue w/ list expression & spring boot?

Posted by dmitriyC300 <dm...@gmail.com>.
Created CAMEL-10385 & corresponding pull request



--
View this message in context: http://camel.465427.n5.nabble.com/ognl-issue-w-list-expression-spring-boot-tp5788692p5788714.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ognl issue w/ list expression & spring boot?

Posted by dmitriyC300 <dm...@gmail.com>.
will do



--
View this message in context: http://camel.465427.n5.nabble.com/ognl-issue-w-list-expression-spring-boot-tp5788692p5788696.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ognl issue w/ list expression & spring boot?

Posted by Claus Ibsen <cl...@gmail.com>.
Yes if you can build a sample unit tests / sample project that can
demonstrate this to help fix the bug.

On Wed, Oct 12, 2016 at 4:28 PM, dmitriyC300 <dm...@gmail.com> wrote:
> It appears that there may be a conflict running simple expression w/ List
> under spring boot.  SpringTypeConverter is registered as a fallback
> converter which gets picked up during ognl while attempting to convert list
> -> map causing an exception instead of a null response that is expected.  It
> is happening under 2.17 & 2.18.  Let me know if I should submit a jira
> ticket or if I am missing something here.
>
> sample expression: ${body.list[0].field}
>
> 10:20:32.499 [main] TRACE o.a.c.i.c.DefaultTypeConverter | Converting
> java.util.ArrayList -> java.util.Map
> 10:20:32.500 [main] TRACE o.a.c.i.c.DefaultTypeConverter | Using converter:
> org.apache.camel.impl.converter.ArrayTypeConverter@79d7035 to convert [class
> java.util.ArrayList=>interface java.util.Map]
>
>
> Caused by: org.apache.camel.TypeConversionException: Error during type
> conversion from type: java.util.ArrayList to the required type:
> java.util.Map with due Failed to convert from type [java.util.ArrayList<?>]
> to type [java.util.Map<?, ?>]
>         at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
>         at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:150)
>         at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:121)
>         at
> org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.lookupResult(BeanExpression.java:358)
>         at
> org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:334)
>         at
> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)
>         ... 55 common frames omitted
> Caused by: org.springframework.core.convert.ConversionFailedException:
> Failed to convert from type [java.util.ArrayList<?>] to type
> [java.util.Map<?, ?>]
>         at
> org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:42)
>         at
> org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192)
>         at
> org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176)
>         at
> org.apache.camel.spring.boot.SpringTypeConverter.convertTo(SpringTypeConverter.java:46)
>         at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:346)
>         at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:133)
>         ... 59 common frames omitted
>
> Dmitriy
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ognl-issue-w-list-expression-spring-boot-tp5788692.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2