// Check to see if the feed requires authentication
if (source.getAuthentication() != null) //requires auth
{
try
{
FeedFetcher feedFetcher = new HttpClientFeedFetcher(null, authenticateFeed(source.getAuthentication()));
if ((null != source.getRssConfig()) && (null != source.getRssConfig().getUserAgent())) {
feedFetcher.setUserAgent(source.getRssConfig().getUserAgent());
}
SyndFeed retVal = feedFetcher.retrieveFeed(new URL(this.cleanUrlStart(url)));
if (null == retVal) {
handleRssError(new RuntimeException("Unknown RSS error") , source);
}
return retVal;
}
catch (Exception e) {
System.out.println(i + " " + url);
if (1 == i) { // else just try again
handleRssError(e, source);
}
}
}
else //does not require auth
{
try
{
FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);
if ((null != source.getRssConfig()) && (null != source.getRssConfig().getUserAgent())) {
feedFetcher.setUserAgent(source.getRssConfig().getUserAgent());
}
SyndFeed retVal = feedFetcher.retrieveFeed(new URL(this.cleanUrlStart(url)));
if (null == retVal) {
handleRssError(new RuntimeException("Unknown RSS error") , source);
}
return retVal;
}