From b70986ef168bf17f91e817247e0d7779d33736ce Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 23 May 2014 16:49:48 -0400 Subject: [PATCH] LocalRepoKeyStore.setupHTTPSCertificate() handles all exceptions itself Since there is nothing happening with the Exceptions anyway, they should be handled in this method so that this method is easy to use elsewhere. --- .../fdroid/localrepo/LocalRepoKeyStore.java | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/org/fdroid/fdroid/localrepo/LocalRepoKeyStore.java b/src/org/fdroid/fdroid/localrepo/LocalRepoKeyStore.java index ec83f4447..b48a684e0 100644 --- a/src/org/fdroid/fdroid/localrepo/LocalRepoKeyStore.java +++ b/src/org/fdroid/fdroid/localrepo/LocalRepoKeyStore.java @@ -133,24 +133,25 @@ public class LocalRepoKeyStore { } } - public void setupHTTPSCertificate() throws CertificateException, - OperatorCreationException, KeyStoreException, NoSuchAlgorithmException, - FileNotFoundException, IOException, UnrecoverableKeyException { - // Get the existing private/public keypair to use for the HTTPS cert - KeyPair kerplappKeypair = getKerplappKeypair(); + public void setupHTTPSCertificate() { + try { + // Get the existing private/public keypair to use for the HTTPS cert + KeyPair kerplappKeypair = getKerplappKeypair(); - /* - * Once we have an IP address, that can be used as the hostname. We can - * generate a self signed cert with a valid CN field to stash into the - * keystore in a predictable place. If the IP address changes we should - * run this method again to stomp old HTTPS_CERT_ALIAS entries. - */ - X500Name subject = new X500Name("CN=" + FDroidApp.ipAddressString); - - Certificate indexCert = generateSelfSignedCertChain(kerplappKeypair, subject, - FDroidApp.ipAddressString); - - addToStore(HTTP_CERT_ALIAS, kerplappKeypair, indexCert); + /* + * Once we have an IP address, that can be used as the hostname. We + * can generate a self signed cert with a valid CN field to stash + * into the keystore in a predictable place. If the IP address + * changes we should run this method again to stomp old + * HTTPS_CERT_ALIAS entries. + */ + X500Name subject = new X500Name("CN=" + FDroidApp.ipAddressString); + Certificate indexCert = generateSelfSignedCertChain(kerplappKeypair, subject, + FDroidApp.ipAddressString); + addToStore(HTTP_CERT_ALIAS, kerplappKeypair, indexCert); + } catch (Exception e) { + e.printStackTrace(); + } } public File getKeyStoreFile() {