mirror of https://github.com/readrops/Readrops.git
Fix rss request bug
This commit is contained in:
parent
ba4a0f0db0
commit
9e13b3aca0
|
@ -60,7 +60,7 @@ public class LocalFeedRepository extends ARepository implements QueryCallback {
|
||||||
if (feed.getLastModified() != null)
|
if (feed.getLastModified() != null)
|
||||||
headers.put(LibUtils.IF_MODIFIED_HEADER, feed.getLastModified());
|
headers.put(LibUtils.IF_MODIFIED_HEADER, feed.getLastModified());
|
||||||
|
|
||||||
rssNet.request(feed.getUrl(), headers);
|
rssNet.requestUrl(feed.getUrl(), headers);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
failureCallBackInMainThread(e);
|
failureCallBackInMainThread(e);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public class LocalFeedRepository extends ARepository implements QueryCallback {
|
||||||
try {
|
try {
|
||||||
RSSNetwork rssNet = new RSSNetwork();
|
RSSNetwork rssNet = new RSSNetwork();
|
||||||
rssNet.setCallback(this);
|
rssNet.setCallback(this);
|
||||||
rssNet.request(result.getUrl(), new HashMap<>());
|
rssNet.requestUrl(result.getUrl(), new HashMap<>());
|
||||||
|
|
||||||
postCallBackSuccess();
|
postCallBackSuccess();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class RSSNetwork {
|
||||||
* @param url url to request
|
* @param url url to request
|
||||||
* @throws Exception
|
* @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)
|
if (callback == null)
|
||||||
throw new NullPointerException("Callback can't be null");
|
throw new NullPointerException("Callback can't be null");
|
||||||
|
|
||||||
|
@ -137,7 +137,8 @@ public class RSSNetwork {
|
||||||
if (contentType == RSSType.RSS_UNKNOWN) {
|
if (contentType == RSSType.RSS_UNKNOWN) {
|
||||||
callback.onSyncFailure(new Exception("Unknown content format"));
|
callback.onSyncFailure(new Exception("Unknown content format"));
|
||||||
return;
|
return;
|
||||||
}
|
} else
|
||||||
|
type = contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
String etag = response.header(LibUtils.ETAG_HEADER);
|
String etag = response.header(LibUtils.ETAG_HEADER);
|
||||||
|
|
Loading…
Reference in New Issue