Invalid key file is an expected error

This commit is contained in:
M66B 2021-01-30 08:56:32 +01:00
parent 28dcb2a1b1
commit 329a557fa5
1 changed files with 4 additions and 2 deletions

View File

@ -1121,7 +1121,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
// throws DecoderException extends IllegalStateException
PemObject pem = new PemReader(new InputStreamReader(is)).readPemObject();
if (pem == null)
throw new IllegalStateException("Invalid key file");
throw new IllegalArgumentException("Invalid key file");
ByteArrayInputStream bis = new ByteArrayInputStream(pem.getContent());
cert = (X509Certificate) fact.generateCertificate(bis);
}
@ -1147,7 +1147,9 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
@Override
protected void onException(Bundle args, Throwable ex) {
boolean expected = (ex instanceof SecurityException);
boolean expected =
(ex instanceof IllegalArgumentException ||
ex instanceof SecurityException);
Log.unexpectedError(getSupportFragmentManager(), ex, !expected);
}
}.execute(this, args, "setup:cert");