Vladimir Dobos created CAMEL-15455:
--------------------------------------

             Summary: 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


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