Bug 1403787 - Change try/catch to catch the correct exception r=nalexander draft
authorGrigory Kruglov <gkruglov@mozilla.com>
Mon, 30 Oct 2017 03:17:48 -0700
changeset 688607 7cd05594680642f867e15363d06aa628138c73f0
parent 688337 d3910b7628b8066d3f30d58b17b5824b05768854
child 738122 c1e5e0f48b2c72310fbd97c7b45d64797ce0fb76
push id86806
push usergkruglov@mozilla.com
push dateMon, 30 Oct 2017 10:18:55 +0000
reviewersnalexander
bugs1403787
milestone58.0a1
Bug 1403787 - Change try/catch to catch the correct exception r=nalexander We're aiming to catch FileNotFound exceptions here, but underneath they're re-thrown as IllegalStateException. MozReview-Commit-ID: HaCpbqq93q0
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/devices/FxAccountDeviceRegistrator.java
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/devices/FxAccountDeviceRegistrator.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/devices/FxAccountDeviceRegistrator.java
@@ -290,17 +290,17 @@ public class FxAccountDeviceRegistrator 
     fxAccount.setDeviceRegistrationTimestamp(0L);
   }
 
   private static String getClientName(final AndroidFxAccount fxAccount, final Context context) {
     try {
       final SharedPreferencesClientsDataDelegate clientsDataDelegate =
           new SharedPreferencesClientsDataDelegate(fxAccount.getSyncPrefs(), context);
       return clientsDataDelegate.getClientName();
-    } catch (IOException | GeneralSecurityException e) {
+    } catch (Exception e) {
       Log.e(LOG_TAG, "Unable to get client name.", e);
       // It's possible we're racing against account pickler.
       // In either case, it should be always safe to perform registration using our default name.
       return FxAccountUtils.defaultClientName(context);
     }
   }
 
   private static void handleTokenError(final FxAccountClientRemoteException error,