Skip to content
Snippets Groups Projects
Commit 3c55eb1f authored by Ricki Hirner's avatar Ricki Hirner :sheep:
Browse files

Don't throw an unchecked exception when bindService fails

parent 30b8bc58
No related branches found
No related tags found
No related merge requests found
......@@ -110,7 +110,7 @@ public class CustomCertManager implements X509TrustManager, Closeable {
this.service = service;
serviceConnection = null;
} else if (!context.bindService(new Intent(context, CustomCertService.class), serviceConnection, Context.BIND_AUTO_CREATE))
throw new IllegalArgumentException("Couldn't bind service to this context");
Constants.log.severe("Couldn't bind CustomCertService to context");
}
@Override
......@@ -153,6 +153,9 @@ public class CustomCertManager implements X509TrustManager, Closeable {
protected void checkCustomTrusted(X509Certificate cert) throws CertificateException {
Constants.log.fine("Querying custom certificate trustworthiness");
if (service == null)
throw new CertificateException("Custom certificate service not available");
Message msg = Message.obtain();
msg.what = CustomCertService.MSG_CHECK_TRUSTED;
int id = msg.arg1 = nextDecisionID.getAndIncrement();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment