You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Ernst Bunders (JIRA)" <ji...@apache.org> on 2010/09/10 12:53:40 UTC
[jira] Created: (CAMEL-3114) url encoding goes wrong in
org.apache.camel.component.rss.RssComponent#afterConfiguration
url encoding goes wrong in org.apache.camel.component.rss.RssComponent#afterConfiguration
-----------------------------------------------------------------------------------------
Key: CAMEL-3114
URL: https://issues.apache.org/activemq/browse/CAMEL-3114
Project: Apache Camel
Issue Type: Bug
Affects Versions: 2.4.0
Environment: jdk: Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
platform: linux (ubuntu 10.04)
Reporter: Ernst Bunders
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: http://api.flickr.com/services/feeds/photos_public.gne?id=23353282@N05&tags=lowlands&lang=en-us&format=rss_200
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 java.net.URLEncoder#encode, 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
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
regards,
Ernst Bunders
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-3114) url encoding goes wrong in
org.apache.camel.component.rss.RssComponent#afterConfiguration
Posted by "Ernst Bunders (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ernst Bunders updated CAMEL-3114:
---------------------------------
Attachment: test.groovy
this script demonstrates the problem
> url encoding goes wrong in org.apache.camel.component.rss.RssComponent#afterConfiguration
> -----------------------------------------------------------------------------------------
>
> Key: CAMEL-3114
> URL: https://issues.apache.org/activemq/browse/CAMEL-3114
> Project: Apache Camel
> Issue Type: Bug
> Affects Versions: 2.4.0
> Environment: jdk: Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> platform: linux (ubuntu 10.04)
> Reporter: Ernst Bunders
> Attachments: test.groovy
>
>
> 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: http://api.flickr.com/services/feeds/photos_public.gne?id=23353282@N05&tags=lowlands&lang=en-us&format=rss_200
> 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 java.net.URLEncoder#encode, 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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
> regards,
> Ernst Bunders
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (CAMEL-3114) url encoding goes wrong in
org.apache.camel.component.rss.RssComponent#afterConfiguration
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen reassigned CAMEL-3114:
----------------------------------
Assignee: Claus Ibsen
> url encoding goes wrong in org.apache.camel.component.rss.RssComponent#afterConfiguration
> -----------------------------------------------------------------------------------------
>
> Key: CAMEL-3114
> URL: https://issues.apache.org/activemq/browse/CAMEL-3114
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-rss
> Affects Versions: 2.4.0
> Environment: jdk: Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> platform: linux (ubuntu 10.04)
> Reporter: Ernst Bunders
> Assignee: Claus Ibsen
> Attachments: test.groovy
>
>
> 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: http://api.flickr.com/services/feeds/photos_public.gne?id=23353282@N05&tags=lowlands&lang=en-us&format=rss_200
> 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 java.net.URLEncoder#encode, 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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
> regards,
> Ernst Bunders
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CAMEL-3114) url encoding goes wrong in
org.apache.camel.component.rss.RssComponent#afterConfiguration
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-3114.
--------------------------------
Fix Version/s: 2.5.0
Resolution: Fixed
trunk: 998608.
I found the bug and fixed it. I can now read the feed from flickr.
Thanks for reporting. Feel free to test it on your system as well.
> url encoding goes wrong in org.apache.camel.component.rss.RssComponent#afterConfiguration
> -----------------------------------------------------------------------------------------
>
> Key: CAMEL-3114
> URL: https://issues.apache.org/activemq/browse/CAMEL-3114
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-rss
> Affects Versions: 2.4.0
> Environment: jdk: Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> platform: linux (ubuntu 10.04)
> Reporter: Ernst Bunders
> Assignee: Claus Ibsen
> Fix For: 2.5.0
>
> Attachments: test.groovy
>
>
> 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: http://api.flickr.com/services/feeds/photos_public.gne?id=23353282@N05&tags=lowlands&lang=en-us&format=rss_200
> 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 java.net.URLEncoder#encode, 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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
> regards,
> Ernst Bunders
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3114) url encoding goes wrong in
org.apache.camel.component.rss.RssComponent#afterConfiguration
Posted by "Ernst Bunders (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61850#action_61850 ]
Ernst Bunders commented on CAMEL-3114:
--------------------------------------
I guess I could do that
> url encoding goes wrong in org.apache.camel.component.rss.RssComponent#afterConfiguration
> -----------------------------------------------------------------------------------------
>
> Key: CAMEL-3114
> URL: https://issues.apache.org/activemq/browse/CAMEL-3114
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-rss
> Affects Versions: 2.4.0
> Environment: jdk: Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> platform: linux (ubuntu 10.04)
> Reporter: Ernst Bunders
> Attachments: test.groovy
>
>
> 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: http://api.flickr.com/services/feeds/photos_public.gne?id=23353282@N05&tags=lowlands&lang=en-us&format=rss_200
> 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 java.net.URLEncoder#encode, 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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
> regards,
> Ernst Bunders
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CAMEL-3114) url encoding goes wrong in
org.apache.camel.component.rss.RssComponent#afterConfiguration
Posted by "Ernst Bunders (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ernst Bunders updated CAMEL-3114:
---------------------------------
Component/s: camel-rss
> url encoding goes wrong in org.apache.camel.component.rss.RssComponent#afterConfiguration
> -----------------------------------------------------------------------------------------
>
> Key: CAMEL-3114
> URL: https://issues.apache.org/activemq/browse/CAMEL-3114
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-rss
> Affects Versions: 2.4.0
> Environment: jdk: Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> platform: linux (ubuntu 10.04)
> Reporter: Ernst Bunders
> Attachments: test.groovy
>
>
> 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: http://api.flickr.com/services/feeds/photos_public.gne?id=23353282@N05&tags=lowlands&lang=en-us&format=rss_200
> 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 java.net.URLEncoder#encode, 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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
> regards,
> Ernst Bunders
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CAMEL-3114) url encoding goes wrong in
org.apache.camel.component.rss.RssComponent#afterConfiguration
Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/activemq/browse/CAMEL-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61848#action_61848 ]
Claus Ibsen commented on CAMEL-3114:
------------------------------------
Can you create a pure Java unit test which demonstrates this, then it can be included as an unit test in the source
> url encoding goes wrong in org.apache.camel.component.rss.RssComponent#afterConfiguration
> -----------------------------------------------------------------------------------------
>
> Key: CAMEL-3114
> URL: https://issues.apache.org/activemq/browse/CAMEL-3114
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-rss
> Affects Versions: 2.4.0
> Environment: jdk: Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> platform: linux (ubuntu 10.04)
> Reporter: Ernst Bunders
> Attachments: test.groovy
>
>
> 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: http://api.flickr.com/services/feeds/photos_public.gne?id=23353282@N05&tags=lowlands&lang=en-us&format=rss_200
> 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 java.net.URLEncoder#encode, 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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: http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&id=23353282%2540N05&lang=en-us&tags=lowlands
> 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
> regards,
> Ernst Bunders
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.