Skip to content

Commit 6faa6b9

Browse files
AndrewScullAndroid (Google) Code Review
authored andcommitted
Merge "Handle all exceptions resetPassword can throw." into ub-testdpc-nyc
2 parents 6ac1eb2 + 7782b2a commit 6faa6b9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/src/main/java/com/afwsamples/testdpc/policy/PolicyManagementFragment.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,9 +970,10 @@ public void onClick(DialogInterface dialogInterface, int which) {
970970
boolean ok = false;
971971
try {
972972
ok = mDevicePolicyManager.resetPassword(password, flags);
973-
} catch (IllegalArgumentException iae) {
974-
// Bad password, eg. 2 characters where system minimum length is 4.
975-
Log.w(TAG, "Failed to reset password", iae);
973+
} catch (IllegalArgumentException | IllegalStateException | SecurityException e) {
974+
// Not allowed to set password or trying to set a bad password, eg. 2 characters
975+
// where system minimum length is 4.
976+
Log.w(TAG, "Failed to reset password", e);
976977
}
977978
showToast(ok ? R.string.password_reset_success : R.string.password_reset_failed);
978979
}

0 commit comments

Comments
 (0)