1. Camel
  2. CAMEL-3114

url encoding goes wrong in org.apache.camel.component.rss.RssComponent#afterConfiguration


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.0
    • Fix Version/s: 2.5.0
    • Component/s: camel-rss
    • Labels:
    • Environment:

      jdk: Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
      platform: linux (ubuntu 10.04)


      The method org.apache.camel.component.rss.RssComponent#afterConfiguration creates the Url that will be used to fetch the rss feed. We find that with some url's url encoding goes wrong.

      consider this url:

      AfterConfiguration() calls org.apache.camel.util.URISupport#createRemainingURI This method first calls org.apache.camel.util.URISupport#createQueryString, which is a method that will iterate over a map of request parameters, escape each param name and value using, and put them together with all the & and = stuff to form the query string.
      Then it calls org.apache.camel.util.URISupport#createURIWithQuery Which is a method that takes a URI (the base url) and the constructed query string, and simply creates a new URI with that, returning the toString() output from that.

      So this is what the output of this procedure looks like:

      1 the @ sign was escaped by org.apache.camel.util.URISupport#createQueryString, creating a query string like: id=23353282%40N05&tags=lowlands&lang=en-us&format=rss_200 (which is good)
      2 the URI constructor then finds the % in %40 and escapes that again! creating a url like:

      Which predictably fails...

      I did some tests with the URI constructor, and it seems it only escapes % chars, everything else is left alone.

      I attach a groovy script that demonstrates the problem


      Ernst Bunders

      1. test.groovy
        1 kB
        Ernst Bunders


        Ernst Bunders created issue -
        Ernst Bunders made changes -
        Field Original Value New Value
        Attachment test.groovy [ 19633 ]
        Ernst Bunders made changes -
        Component/s camel-rss [ 11773 ]
        Claus Ibsen made changes -
        Assignee Claus Ibsen [ davsclaus ]
        Claus Ibsen made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.5.0 [ 12320 ]
        Resolution Fixed [ 1 ]
        Jeff Turner made changes -
        Project Import Sat Nov 27 00:14:50 EST 2010 [ 1290834890113 ]
        Claus Ibsen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            Claus Ibsen
            Ernst Bunders
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: