i am trying to create rss feeds app that parses all the websites supporting feed. i used Jsoup for this purpose. and parsed for different type of rss in this way
org.jsoup.select.Elements links = doc.select("link[type=application/rss+xml]");
org.jsoup.select.Elements links = doc.select("link[type=application/atom+xml]");
it parses various websites like engadget.com, ndtv.com etc but when i tried to pase websites like stackoverflow.com or 1up.com i got the following error.
thread exiting with uncaught exception (group=0x40efe378)
and
Caused by: java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=/rss
searching for error #1 didnt yield even 1 results. searching for eroror #2 had many. all stated to use http:// before any websites url like
http://1up.com
but then too the error persists. and i had already implemented this before since all other websites rss are parsed. this is my logcat for 1up.com rss feed.
D/URL Length(4097): 14
D/url name(4097): http://1up.com
D/No of RSS links found(4097): 1
W/dalvikvm(4097): threadid=12: thread exiting with uncaught exception (group=0x40efe378)
E/AndroidRuntime(4097): FATAL EXCEPTION: AsyncTask #1
E/AndroidRuntime(4097): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(4097): at android.os.AsyncTask$3.done(AsyncTask.java:299)
E/AndroidRuntime(4097): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
E/AndroidRuntime(4097): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
E/AndroidRuntime(4097): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
E/AndroidRuntime(4097): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
E/AndroidRuntime(4097): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
E/AndroidRuntime(4097): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
E/AndroidRuntime(4097): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
E/AndroidRuntime(4097): at java.lang.Thread.run(Thread.java:856)
E/AndroidRuntime(4097): Caused by: java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=/rss
E/AndroidRuntime(4097): at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:591)
E/AndroidRuntime(4097): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:293)
E/AndroidRuntime(4097): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
E/AndroidRuntime(4097): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
E/AndroidRuntime(4097): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
E/AndroidRuntime(4097): at com.maulik.rss.RssParser.getXmlFromUrl(RssParser.java:214)
E/AndroidRuntime(4097): at com.maulik.rss.RssParser.getRSSFeed(RssParser.java:69)
E/AndroidRuntime(4097): at com.maulik.rss.RSS_AddNewSiteActivity$loadRSSFeed.doInBackground(RSS_AddNewSiteActivity.java:97)
E/AndroidRuntime(4097): at com.maulik.rss.RSS_AddNewSiteActivity$loadRSSFeed.doInBackground(RSS_AddNewSiteActivity.java:1)
E/AndroidRuntime(4097): at android.os.AsyncTask$2.call(AsyncTask.java:287)
E/AndroidRuntime(4097): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
E/AndroidRuntime(4097): ... 5 more
IllegalStateException: Target host must not be null, or set in parameters.indicates that the problem is caused by invalid (or null) RSS address. From 1up.com :<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss?x=1" />and from your logcat output seems the request goes to wrong address: rss?x=1 (or same w/o http) so instead of the relative link 1up.com/rss, it handles the link as an absolute one. You could detect relative links and convert them to absolute ones before parsing feeds.