Bug 1241810 - FeedSubscription: Treat ETag and "Last modified" header as optional. r?mcomella draft
authorSebastian Kaspari <s.kaspari@gmail.com>
Thu, 25 Feb 2016 12:21:08 -0800
changeset 335181 2b4cf286b09075624a4de441ea8c11353a3d255c
parent 335180 ecd55542d9a1da37e599c0b5a67fcf7cc33106d7
child 335182 a44cef0c5a6e22fa98b91a27ca2e128c7d0c11d2
push id11746
push users.kaspari@gmail.com
push dateSat, 27 Feb 2016 23:17:50 +0000
reviewersmcomella
bugs1241810
milestone47.0a1
Bug 1241810 - FeedSubscription: Treat ETag and "Last modified" header as optional. r?mcomella Some services just do not return any of those headers. MozReview-Commit-ID: 3LpvZqsHgzJ
mobile/android/base/java/org/mozilla/gecko/feeds/subscriptions/FeedSubscription.java
--- a/mobile/android/base/java/org/mozilla/gecko/feeds/subscriptions/FeedSubscription.java
+++ b/mobile/android/base/java/org/mozilla/gecko/feeds/subscriptions/FeedSubscription.java
@@ -51,18 +51,18 @@ public class FeedSubscription {
         FeedSubscription subscription = new FeedSubscription();
 
         subscription.feedUrl = object.getString(JSON_KEY_FEED_URL);
         subscription.feedTitle = object.getString(JSON_KEY_FEED_TITLE);
         subscription.websiteUrl = object.getString(JSON_KEY_WEBSITE_URL);
         subscription.lastItemTitle = object.getString(JSON_KEY_LAST_ITEM_TITLE);
         subscription.lastItemUrl = object.getString(JSON_KEY_LAST_ITEM_URL);
         subscription.lastItemTimestamp = object.getLong(JSON_KEY_LAST_ITEM_TIMESTAMP);
-        subscription.etag = object.getString(JSON_KEY_ETAG);
-        subscription.lastModified = object.getString(JSON_KEY_LAST_MODIFIED);
+        subscription.etag = object.optString(JSON_KEY_ETAG);
+        subscription.lastModified = object.optString(JSON_KEY_LAST_MODIFIED);
         subscription.bookmarkGuid = object.getString(JSON_KEY_BOOKMARK_GUID);
 
         return subscription;
     }
 
     /* package-private */ void update(FeedFetcher.FeedResponse response) {
         final String feedUrl = response.feed.getFeedURL();
         if (!TextUtils.isEmpty(feedUrl)) {