display error messages

This commit is contained in:
Athou
2013-03-31 18:47:17 +02:00
parent a9e5c50b3f
commit 5994369e01
8 changed files with 34 additions and 6 deletions

View File

@@ -43,6 +43,13 @@ public class FeedFetcher {
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
String content = EntityUtils.toString(entity, "UTF-8");
String extractedUrl = extractFeedUrl(content);
if (extractedUrl != null) {
httpget = new HttpGet(feedUrl);
response = httpclient.execute(httpget);
entity = response.getEntity();
content = EntityUtils.toString(entity, "UTF-8");
}
feed = parser.parse(feedUrl, content);
} catch (Exception e) {
throw new FeedException(e.getMessage(), e);
@@ -52,7 +59,7 @@ public class FeedFetcher {
return feed;
}
public String extractFeedUrl(String html) {
private String extractFeedUrl(String html) {
String foundUrl = null;
Document doc = Jsoup.parse(html);