[
https://issues.apache.org/jira/browse/CAMEL-14937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17089315#comment-17089315
]
Jens Kleine-Herzbruch commented on CAMEL-14937:
-----------------------------------------------
I don't have a rproducer at the ready but the main problem is that
typeName.evaluate(exchange, String.class) with typeName being e.g. a
constantExpression(String.class) results in the string "class java.lang.String".
When that gets fed into the class resolver, it fails.
So either the class resolver needs to handle that case (probably not the
correct solution), or the type converter needs to make sure to convert to
"java.lang.String", or the headerExpression code needs to use the passed in
class parameter directly instead of converting to class name and back to class.
> ExpressionBuilder.headerExpression("name", class) results in
> ClassNotFoundException
> -----------------------------------------------------------------------------------
>
> Key: CAMEL-14937
> URL: https://issues.apache.org/jira/browse/CAMEL-14937
> Project: Camel
> Issue Type: Bug
> Components: came-core
> Affects Versions: 3.2.0
> Reporter: Jens Kleine-Herzbruch
> Priority: Major
>
> {{ public static <T> Expression headerExpression(final String headerName,
> final Class<T> type) {}}
> {{ return headerExpression(simpleExpression(headerName),
> constantExpression(type));}}
> {{ }}}
>
> and
>
> {{ public static Expression headerExpression(final Expression headerName,
> final Expression typeName)}}
> {{}}{{}}
> tries to resolve the type via
> {{String text = typeName.evaluate(exchange, String.class);}}
> which results in the String "class xxx.yyy.type". Trying to resolve that as a
> class obviously is bound to fail. I'm not sure whether the type converter
> should be changed here or the headerExpression code is wrong.
>
> This worked in 3.1.0, btw.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)