ahorn / android-rss

Lightweight Android library to parse RSS 2.0 feeds.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FATAL EXCEPTION: AsyncTask #1 when no internet.

ashleypeacock opened this issue · comments

Unfortunately not much more information is given although it is caused by this line:

feed = reader.load(uri);

commented

If you think this is a bug, could you reproduce this exception with a test case? See https://github.com/ahorn/android-rss/tree/master/src/test/java/org/mcsoxford/rss

What behaviour would you expect?

Yep sure thing. I am pretty sure this is a bug i've tried multiple ways around this. Just trying to get the sources imported into Android studio.
Thanks for your reply :)

Ok,
So
load(url) was throwing an RSSFault which I wasn't catching as I was only catching RSSExceptions. Added this which prevents the problem with ASyncTask.

protected RSSFeed doInBackground(String... urls) {
            RSSReader reader = new RSSReader();
            RSSFeed feed = null;
            try {
                feed = reader.load(urls[0]);
                feed.toString();
            }catch(RSSException rs) {
                Log.e(this.getClass().getSimpleName(), "Error gettig list", rs);
            } catch (RSSFault fault) {
                Log.e(this.getClass().getSimpleName(), "Error with RSSFault", fault);
            }
            return feed;
        }
commented

It would make sense if fault.getCause() and fault.getMessage() indicate that an IOException was raised (should you wish to make your error message more precise).