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. Maps doesn't show

Hello,
I have map in my android app.
On emulator is everything OK.
But on device (Motorola Droid) the map shows marker but doesn't show
real map in background!!
The conection is OK and I held the INTERNET permission in my manifest.
What is causing this problem? Any idea?

thnks!

--

2. Send GPS Location Details to Server

Hello All,

I am developing a GPS application.. By using the windowsXP OS and
eclips IDE

I am able to get the Longitude and Latitude of the current Position
I want to sent those details to server by using the Http connection
and for that sending, I will use gprs connection in my device
how to do this, I am in big confusion. Here one more thing that GPRS
connection is not available at that time we need to sent a SMS to the
server.

Any body help me in this

-- 

3. Is it possible implement Zoom Feature in a custom Camera Activity or not?

4. getThumbnail sometimes is very slow!

5. Online Image in SimpleExpandableList

6. Help getting screen number

7. How to start activity on URLSpan click