You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Kosta Kostelnik (JIRA)" <ji...@apache.org> on 2019/05/28 14:01:00 UTC

[jira] [Created] (CAMEL-13592) Repeated parameters in URI are not treated correctly

Kosta Kostelnik created CAMEL-13592:
---------------------------------------

             Summary: Repeated parameters in URI are not treated correctly
                 Key: CAMEL-13592
                 URL: https://issues.apache.org/jira/browse/CAMEL-13592
             Project: Camel
          Issue Type: Bug
          Components: camel-sql
    Affects Versions: 2.20.1
            Reporter: Kosta Kostelnik


When constructing Camel SQL component with the following URI:
{code:java}
sql:INSERT INTO TABLE ....?batch=true&...&batch=true{code}
Resulting camel endpoint ends up with batch == false. The reason for this is found in 
{code:java}
private static void addParameter // this is in UriSupport.java{code}
This method adds values into a list and then setting the parameter does not work correctly. I believe that Camel should be more linient for such "errors" (which can occur if you construct URI programatically). 

I suggest parameter value detection. If
{code:java}
existing.equals(value) // to use actual names of variables from the code{code}
then just ignore. DO NOT do the following (list construction; current behavior):
{code:java}
if (existing instanceof List) {
    list = CastUtils.cast((List<?>) existing);
} else {
    // create a new list to hold the multiple values
    list = new ArrayList<String>();
    String s = existing != null ? existing.toString() : null;
    if (s != null) {
        list.add(s);
    }
}
list.add(value);
{code}
In the end the URI shown in the beginning will result in Component with batch equal to false. Which is really hard to determine why and what happened. 

 

I believe this is a generic problem tho



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)