Validate a RSS Feed in a java program which uses org.apache.commons.feedparser for parsing Feeds

547 Views Asked by At

I our application we are using apache commons feedparser API, Which works well however i am intending to validate a Feed URL before parsing it. below are the three kind of exceptions that we are using in case of any exception occurs during parsing:

catch (FeedParserException e) {
        log.error("FeedParser Exception for RSS AgentID:: "+rssAgentId+" error message "+e.getMessage());
    } catch (NetworkException e) {
        log.error("Network Exception for RSS AgentID:: "+rssAgentId+" error message "+e.getMessage());
    } catch (IOException e) {
        log.error("IOException Exception for RSS AgentID:: "+rssAgentId+" error message "+e.getMessage());          
    }

When using a few non feed URLs like "www.rediff.com" the control should ideally land in FeedParserException since it is not a valid feed url, but surprisingly it is not, it gives the below warnings:

[2012-01-12 14:17:08,010] WARN (Thread: http-8080-1) org.apache.commons.feedparser.FeedFilter.doDecodeEntities(223) | Filter encountered unknown entities
[2012-01-12 14:17:08,018] WARN (Thread: http-8080-1) org.apache.commons.feedparser.FeedFilter.doDecodeEntities(226) | Filter has decoded latin1 entities.

and after a long wait say approx 127 seconds it gives a timeout.

Could there be a way i can do a better validation before parsing so that i may not have to wait for 2 minutes in order to display the error message OR is there a way i can decrease this timeout.

0

There are 0 best solutions below