Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15455

EndpointDSL breaks expressions in query parameters

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.3
    • Fix Version/s: 3.5.0, 3.4.4
    • Component/s: camel-endpointdsl
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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:

      .toD(seda("someName").size("${header.size}"))

      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)

      ...
      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}"
      ...
      
      
      

      Enclosing expressions in RAW(..), fixes the issue, it is however quite suboptimal.

      Following workaround will work:

      .toD(seda("someName").size("RAW(${header.size})"))

       

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              vdobos Vladimir Dobos
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: