[ 
https://issues.apache.org/jira/browse/CAMEL-15455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17183376#comment-17183376
 ] 

Claus Ibsen commented on CAMEL-15455:
-------------------------------------

So this is more about toD being dynamic and you are using simple expressions 
for those parameters. A regular to would not accept ${header.xxx} in the size 
parameter. And therefore we may not have noticed this before.

> EndpointDSL breaks expressions in query parameters
> --------------------------------------------------
>
>                 Key: CAMEL-15455
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15455
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-endpointdsl
>    Affects Versions: 3.4.3
>            Reporter: Vladimir Dobos
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.5.0, 3.4.4
>
>
> Expressions in parameters are destroyed by url-encoding during url creation 
> in AbstractEndpointBuilder (using little non-sensical example to make 
> reproduction setup easier).
> For example:
> {code:java}
> .toD(seda("someName").size("${header.size}")){code}
> will be translated by AbstractEndpointBuilder#computeUri (which uses 
> URISupport#createQueryString) to
> _seda://someName?size=%24%7Bheader.size%7D_
> This will, of course, throw exception on endpoint creation.
> For some reason, thrown exception is url-decoded, so parameter names will 
> look OK, even when they are broken (this makes the error more difficult to 
> spot)
> {code:java}
> ...
> java.lang.String to the required type: int with value ${header.size} due to 
> org.apache.camel.TypeConversionException: Error during type conversion from 
> type: java.lang.String to the required type: java.lang.Integer with value 
> ${header.size} due to java.lang.NumberFormatException: For input string: 
> "${header.size}"
> ...
> {code}
> Enclosing expressions in RAW(..), fixes the issue, it is however quite 
> suboptimal.
> Following workaround will work:
> {code:java}
> .toD(seda("someName").size("RAW(${header.size})")){code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to