Bug 1401749 - Remove fallback int->boolean conversion in FxAccountsDevice. r?Grisha draft
authorEdouard Oger <eoger@fastmail.com>
Tue, 10 Oct 2017 12:53:09 -0400
changeset 677724 07ff95593d3ad4799495f51040df063148884f35
parent 677214 77a4c52e9987d2359969d7c478183b438b464744
child 735197 7dcd1004c55322df872b6a02278fe73d339f8a1a
push id83778
push userbmo:eoger@fastmail.com
push dateTue, 10 Oct 2017 16:56:07 +0000
reviewersGrisha
bugs1401749
milestone58.0a1
Bug 1401749 - Remove fallback int->boolean conversion in FxAccountsDevice. r?Grisha MozReview-Commit-ID: miGvypXH1C
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/devices/FxAccountDevice.java
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/devices/FxAccountDevice.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/devices/FxAccountDevice.java
@@ -46,28 +46,17 @@ public class FxAccountDevice {
     final String name = json.getString(JSON_KEY_NAME);
     final String id = json.getString(JSON_KEY_ID);
     final String type = json.getString(JSON_KEY_TYPE);
     final Boolean isCurrentDevice = json.getBoolean(JSON_KEY_ISCURRENTDEVICE);
     final Long lastAccessTime = json.getLong(JSON_KEY_LAST_ACCESS_TIME);
     final String pushCallback = json.getString(JSON_KEY_PUSH_CALLBACK);
     final String pushPublicKey = json.getString(JSON_KEY_PUSH_PUBLICKEY);
     final String pushAuthKey = json.getString(JSON_KEY_PUSH_AUTHKEY);
-    // The FxA server sends this boolean as a number (bug):
-    // https://github.com/mozilla/fxa-auth-server/pull/2122
-    // Use getBoolean directly once the fix is deployed (probably ~Oct-Nov 2017).
-    final Object pushEndpointExpiredRaw = json.get(JSON_KEY_PUSH_ENDPOINT_EXPIRED);
-    final Boolean pushEndpointExpired;
-    if (pushEndpointExpiredRaw instanceof Number) {
-      pushEndpointExpired = ((Number) pushEndpointExpiredRaw).intValue() == 1;
-    } else if (pushEndpointExpiredRaw instanceof Boolean) {
-      pushEndpointExpired = (Boolean) pushEndpointExpiredRaw;
-    } else {
-      pushEndpointExpired = false;
-    }
+    final Boolean pushEndpointExpired = json.getBoolean(JSON_KEY_PUSH_ENDPOINT_EXPIRED);
     return new FxAccountDevice(name, id, type, isCurrentDevice, lastAccessTime, pushCallback,
                                pushPublicKey, pushAuthKey, pushEndpointExpired);
   }
 
   public ExtendedJSONObject toJson() {
     final ExtendedJSONObject body = new ExtendedJSONObject();
     if (this.name != null) {
       body.put(JSON_KEY_NAME, this.name);