From 9e13b3aca0c420bcf376eed5a4e521c54f901b36 Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Fri, 22 Feb 2019 12:22:49 +0000 Subject: [PATCH] Fix rss request bug --- app/src/main/java/com/readrops/app/LocalFeedRepository.java | 4 ++-- .../com/readrops/readropslibrary/localfeed/RSSNetwork.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/readrops/app/LocalFeedRepository.java b/app/src/main/java/com/readrops/app/LocalFeedRepository.java index b72f7eca..6cd5013f 100644 --- a/app/src/main/java/com/readrops/app/LocalFeedRepository.java +++ b/app/src/main/java/com/readrops/app/LocalFeedRepository.java @@ -60,7 +60,7 @@ public class LocalFeedRepository extends ARepository implements QueryCallback { if (feed.getLastModified() != null) headers.put(LibUtils.IF_MODIFIED_HEADER, feed.getLastModified()); - rssNet.request(feed.getUrl(), headers); + rssNet.requestUrl(feed.getUrl(), headers); } catch (Exception e) { failureCallBackInMainThread(e); } @@ -76,7 +76,7 @@ public class LocalFeedRepository extends ARepository implements QueryCallback { try { RSSNetwork rssNet = new RSSNetwork(); rssNet.setCallback(this); - rssNet.request(result.getUrl(), new HashMap<>()); + rssNet.requestUrl(result.getUrl(), new HashMap<>()); postCallBackSuccess(); } catch (Exception e) { diff --git a/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/RSSNetwork.java b/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/RSSNetwork.java index aa4caec1..2689a2a9 100644 --- a/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/RSSNetwork.java +++ b/readropslibrary/src/main/java/com/readrops/readropslibrary/localfeed/RSSNetwork.java @@ -40,7 +40,7 @@ public class RSSNetwork { * @param url url to request * @throws Exception */ - public void request(String url, Map headers) throws Exception { + public void requestUrl(String url, Map headers) throws Exception { if (callback == null) throw new NullPointerException("Callback can't be null"); @@ -137,7 +137,8 @@ public class RSSNetwork { if (contentType == RSSType.RSS_UNKNOWN) { callback.onSyncFailure(new Exception("Unknown content format")); return; - } + } else + type = contentType; } String etag = response.header(LibUtils.ETAG_HEADER);