mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-27 16:33:47 +00:00
Improved error message
This commit is contained in:
parent
e8ae7dfd98
commit
81d82d3f08
1 changed files with 4 additions and 1 deletions
|
@ -1030,9 +1030,10 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||||
if (der)
|
if (der)
|
||||||
cert = (X509Certificate) fact.generateCertificate(is);
|
cert = (X509Certificate) fact.generateCertificate(is);
|
||||||
else {
|
else {
|
||||||
|
// throws DecoderException extends IllegalStateException
|
||||||
PemObject pem = new PemReader(new InputStreamReader(is)).readPemObject();
|
PemObject pem = new PemReader(new InputStreamReader(is)).readPemObject();
|
||||||
if (pem == null)
|
if (pem == null)
|
||||||
throw new IllegalArgumentException(context.getString(R.string.title_invalid_key));
|
throw new IllegalStateException();
|
||||||
ByteArrayInputStream bis = new ByteArrayInputStream(pem.getContent());
|
ByteArrayInputStream bis = new ByteArrayInputStream(pem.getContent());
|
||||||
cert = (X509Certificate) fact.generateCertificate(bis);
|
cert = (X509Certificate) fact.generateCertificate(bis);
|
||||||
}
|
}
|
||||||
|
@ -1058,6 +1059,8 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
if (ex instanceof IllegalArgumentException)
|
if (ex instanceof IllegalArgumentException)
|
||||||
ToastEx.makeText(ActivitySetup.this, ex.getMessage(), Toast.LENGTH_LONG).show();
|
ToastEx.makeText(ActivitySetup.this, ex.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
|
else if (ex instanceof IllegalStateException)
|
||||||
|
ToastEx.makeText(ActivitySetup.this, R.string.title_invalid_key, Toast.LENGTH_LONG).show();
|
||||||
else
|
else
|
||||||
Log.unexpectedError(getSupportFragmentManager(), ex);
|
Log.unexpectedError(getSupportFragmentManager(), ex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue