diff --git a/app/src/main/java/app/fedilab/android/activities/LoginActivity.java b/app/src/main/java/app/fedilab/android/activities/LoginActivity.java index bac81e844..e7b8826b5 100644 --- a/app/src/main/java/app/fedilab/android/activities/LoginActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/LoginActivity.java @@ -639,7 +639,7 @@ public class LoginActivity extends BaseActivity { String token = resobj.get("access_token").toString(); String refresh_token = null; if (resobj.has("refresh_token")) - refresh_token = resobj.get("refresh_token").toString(); + refresh_token = resobj.getString("refresh_token"); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token); diff --git a/app/src/main/java/app/fedilab/android/client/PeertubeAPI.java b/app/src/main/java/app/fedilab/android/client/PeertubeAPI.java index 117977fc3..48cfe8ada 100644 --- a/app/src/main/java/app/fedilab/android/client/PeertubeAPI.java +++ b/app/src/main/java/app/fedilab/android/client/PeertubeAPI.java @@ -713,7 +713,7 @@ public class PeertubeAPI { } /*** - * Verifiy credential of the authenticated user *synchronously* + * Verifiy PeertubeInformation of the authenticated user *synchronously* * @return Account */ public PeertubeInformation getPeertubeInformation() throws HttpsConnection.HttpsConnectionException { @@ -791,13 +791,7 @@ public class PeertubeAPI { peertubeInformation.setTranslations(_translations); } - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } catch (JSONException e) { + } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) { e.printStackTrace(); } return peertubeInformation; @@ -921,15 +915,7 @@ public class PeertubeAPI { refresh_token = resobj.get("refresh_token").toString(); newValues.put("access_token", token); newValues.put("refresh_token", refresh_token); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } catch (JSONException e) { - e.printStackTrace(); - } catch (HttpsConnection.HttpsConnectionException e) { + } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException | HttpsConnection.HttpsConnectionException e) { e.printStackTrace(); } return newValues;