Help | RSS Reader Feeds | Socket Exception

by Gaurav » Tue, 28 Apr 2009 22:20:50 GMT


Sponsored Links
 i,

I am trying to access rss feeds :

RSSFEEDOFCHOICE = "http://rss.news.yahoo.com/rss/entertainment";

Below is the code:

try
{
// setup the url
URL url = new URL(urlToRssFeed);

// create the factory
SAXParserFactory factory = SAXParserFactory.newInstance();
// create a parser
SAXParser parser = factory.newSAXParser();

// create the reader (scanner)
XMLReader xmlreader = parser.getXMLReader();
// instantiate our handler
RSSHandler theRssHandler = new RSSHandler();
// assign our handler
xmlreader.setContentHandler(theRssHandler);
Log.i("getFeed", "before inputsource ");
// get our data via the url class

//InputSource is = new InputSource(inputStream);
InputSource is = new InputSource();
is.setByteStream(url.openConnection().getInputStream());
// perform the synchronous parse
xmlreader.parse(is);
// get the results - should be a fully populated RSSFeed
instance, or null on error
return theRssHandler.getFeed();
}
catch (Exception ee)
{
Log.e("getFeed", "ee ==> " +ee.getMessage(),ee);

// if we have a problem, simply return null
return null;
}


below is the exception trace:

04-28 19:47:54.155: INFO/RSSReader: onCreate(854): START
04-28 19:47:54.226: INFO/RSSReader: onCreate(854): RSSFEEDOFCHOICE
http://rss.news.yahoo.com/rss/entertainment
04-28 19:47:54.235: INFO/getFeed(854): urlToRssFeed ==>
http://rss.news.yahoo.com/rss/entertainment
04-28 19:47:54.306: INFO/getFeed(854): before inputsource
04-28 19:47:54.355: ERROR/OSNetworkSystem(854): unknown socket error
-1
04-28 19:47:54.389: ERROR/getFeed(854): ee ==> unknown error
04-28 19:47:54.389: ERROR/getFeed(854): java.net.SocketException:
unknown error
04-28 19:47:54.389: ERROR/getFeed(854): at
org.apache.harmony.luni.platform.OSNetworkSystem.createSocketImpl
(Native Method)
04-28 19:47:54.389: ERROR/getFeed(854): at
org.apache.harmony.luni.platform.OSNetworkSystem.createSocket
(OSNetworkSystem.java:79)
04-28 19:47:54.389: ERROR/getFeed(854): at
org.apache.harmony.luni.net.PlainSocketImpl2.create
(PlainSocketImpl2.java:59)
04-28 19:47:54.389: ERROR/getFeed(854): at
java.net.Socket.checkClosedAndCreate(Socket.java:763)
04-28 19:47:54.389: ERROR/getFeed(854): at java.net.Socket.connect
(Socket.java:910)
04-28 19:47:54.389: ERROR/getFeed(854): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>
(HttpConnection.java:61)
04-28 19:47:54.389: ERROR/getFeed(854): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager
$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
04-28 19:47:54.389: ERROR/getFeed(854): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection
(HttpConnectionManager.java:67)
04-28 19:47:54.389: ERROR/getFeed(854): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection
(HttpURLConnection.java:800)
04-28 19:47:54.389: ERROR/getFeed(854): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect



Other Threads

1. TabActivity with scroll

Hello,

I'm a newbie to Android, and hence I'm half scared that my question
might be too trivial. But I request you to kindly go through it and
suggest me any solutions you might think of.

I'm working on Android v1.5.

I want to use a TabActivity with 6 or 7 or more tabs. However, I do
not want to clutter my screen with so many tabs together. Hence, I'd
like to be able to show, say, 3 tabs on the screen, and to be able to
scroll to the other tabs. How may I achieve this? I could not find any
example for this by Googling.

Thanks in advance,
Priyanka

-- 

2. alphabetic scrollview navigator

is the scrollview with the alphabetic list on the right and annotated 
scrolling a standard component? or is there any support for 
implementing it? sorry i've not had chance to take a look in the 2.0 
API...


thanks
--
jason.vp.engineering.particle

--

3. menu key unlocks phone

4. Getting permission to install Android SDK on University computers

5. Answer and hang up a call

6. Accessing the NFS server from Android : RPC: Unknown protocol issue

7. GLSurfaceView problem/querry