Fix rss request bug

This commit is contained in:
Shinokuni 2019-02-22 12:22:49 +00:00
parent ba4a0f0db0
commit 9e13b3aca0
2 changed files with 5 additions and 4 deletions

View File

@ -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) {

View File

@ -40,7 +40,7 @@ public class RSSNetwork {
* @param url url to request
* @throws Exception
*/
public void request(String url, Map<String, String> headers) throws Exception {
public void requestUrl(String url, Map<String, String> 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);