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 343934 e5205c505298e79f1e787f6cc5e7407a84449b07
parent 343933 3ff13f5f955fa5f2958a183b02b6816be8d99574
child 343935 449943603adce3e6e9d240910f78236b03fe648d
push id13713
push users.kaspari@gmail.com
push dateWed, 23 Mar 2016 15:10:41 +0000
reviewersmcomella
bugs1241810
milestone48.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)) {