eliminate nested try/catch blocks for clearer code
This commit is contained in:
		
							parent
							
								
									6703fa3652
								
							
						
					
					
						commit
						2b59644e02
					
				| @ -96,26 +96,24 @@ public class WifiStateChangeService extends Service { | ||||
|                 if (isCancelled()) | ||||
|                     return null; | ||||
| 
 | ||||
|                 try { | ||||
|                     LocalRepoKeyStore localRepoKeyStore = LocalRepoKeyStore.get(context); | ||||
|                     Certificate localCert = localRepoKeyStore.getCertificate(); | ||||
|                     FDroidApp.repo.fingerprint = Utils.calcFingerprint(localCert); | ||||
|                 // the fingerprint for the local repo's signing key | ||||
|                 LocalRepoKeyStore localRepoKeyStore = LocalRepoKeyStore.get(context); | ||||
|                 Certificate localCert = localRepoKeyStore.getCertificate(); | ||||
|                 FDroidApp.repo.fingerprint = Utils.calcFingerprint(localCert); | ||||
| 
 | ||||
|                     /* | ||||
|                      * Once the IP address is known we need to generate a self | ||||
|                      * signed certificate to use for HTTPS that has a CN field set | ||||
|                      * to the ipAddressString. This must be run in the background | ||||
|                      * because if this is the first time the singleton is run, it | ||||
|                      * can take a while to instantiate. | ||||
|                      */ | ||||
|                     if (Preferences.get().isLocalRepoHttpsEnabled()) | ||||
|                         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)); | ||||
|                 } | ||||
|                 /* | ||||
|                  * Once the IP address is known we need to generate a self | ||||
|                  * signed certificate to use for HTTPS that has a CN field set | ||||
|                  * to the ipAddressString. This must be run in the background | ||||
|                  * because if this is the first time the singleton is run, it | ||||
|                  * can take a while to instantiate. | ||||
|                  */ | ||||
|                 if (Preferences.get().isLocalRepoHttpsEnabled()) | ||||
|                     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 (InterruptedException e) { | ||||
|                 Log.e(TAG, Log.getStackTraceString(e)); | ||||
|             } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hans-Christoph Steiner
						Hans-Christoph Steiner