eliminate nested try/catch blocks for clearer code

This commit is contained in:
Hans-Christoph Steiner 2015-05-09 11:46:11 -04:00
parent 6703fa3652
commit 2b59644e02

View File

@ -96,26 +96,24 @@ public class WifiStateChangeService extends Service {
if (isCancelled()) if (isCancelled())
return null; return null;
try { // the fingerprint for the local repo's signing key
LocalRepoKeyStore localRepoKeyStore = LocalRepoKeyStore.get(context); LocalRepoKeyStore localRepoKeyStore = LocalRepoKeyStore.get(context);
Certificate localCert = localRepoKeyStore.getCertificate(); Certificate localCert = localRepoKeyStore.getCertificate();
FDroidApp.repo.fingerprint = Utils.calcFingerprint(localCert); FDroidApp.repo.fingerprint = Utils.calcFingerprint(localCert);
/* /*
* Once the IP address is known we need to generate a self * Once the IP address is known we need to generate a self
* signed certificate to use for HTTPS that has a CN field set * signed certificate to use for HTTPS that has a CN field set
* to the ipAddressString. This must be run in the background * to the ipAddressString. This must be run in the background
* because if this is the first time the singleton is run, it * because if this is the first time the singleton is run, it
* can take a while to instantiate. * can take a while to instantiate.
*/ */
if (Preferences.get().isLocalRepoHttpsEnabled()) if (Preferences.get().isLocalRepoHttpsEnabled())
localRepoKeyStore.setupHTTPSCertificate(); localRepoKeyStore.setupHTTPSCertificate();
} catch (LocalRepoKeyStore.InitException e) {
Log.e(TAG, "Unable to configure a fingerprint or HTTPS for the local repo: " + e.getMessage());
Log.e(TAG, Log.getStackTraceString(e));
}
} catch (LocalRepoKeyStore.InitException e) {
Log.e(TAG, "Unable to configure a fingerprint or HTTPS for the local repo: " + e.getMessage());
Log.e(TAG, Log.getStackTraceString(e));
} catch (InterruptedException e) { } catch (InterruptedException e) {
Log.e(TAG, Log.getStackTraceString(e)); Log.e(TAG, Log.getStackTraceString(e));
} }