[
https://issues.apache.org/jira/browse/CAMEL-15455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17183498#comment-17183498
]
Claus Ibsen commented on CAMEL-15455:
-------------------------------------
Yeah that is a good observation, so we may want to allow the endpoint dsl to
build with encoded and non encoding depending on the EIP pattern. As others
would depend on current behaviour. And then check if those options are using
simple expressions, eg ${ } or $simple{ } style which is what you used in your
example.
> 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)