[ https://issues.apache.org/jira/browse/CAMEL-13592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16849765#comment-16849765 ]
Claus Ibsen commented on CAMEL-13592: ------------------------------------- Also test with newer version such as 2.24.0 as 2.20.x is somewhat old. > camel-sql - 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 > Priority: Minor > > 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)