瀏覽代碼

catch unchecked exceptions when checking whether linux keychain is accessible
fixes #950, fixes #952, fixes #954

Sebastian Stenzel 5 年之前
父節點
當前提交
c287294890

+ 2 - 0
main/keychain/src/main/java/org/cryptomator/keychain/KeychainAccessStrategy.java

@@ -9,6 +9,8 @@ interface KeychainAccessStrategy extends KeychainAccess {
 
 	/**
 	 * @return <code>true</code> if this KeychainAccessStrategy works on the current machine.
+	 * @implNote This method must not throw any exceptions and should fail fast
+	 * returning <code>false</code> if it can't determine availability of the checked strategy
 	 */
 	boolean isSupported();
 

+ 1 - 1
main/keychain/src/main/java/org/cryptomator/keychain/LinuxSecretServiceKeychainAccessImpl.java

@@ -14,7 +14,7 @@ class LinuxSecretServiceKeychainAccessImpl implements KeychainAccessStrategy {
 		try (@SuppressWarnings("unused") SimpleCollection keyring = new SimpleCollection()) {
 			// seems like we're able to access the keyring.
 			return true;
-		} catch (IOException e) {
+		} catch (IOException | RuntimeException e) {
 			return false;
 		}
 	}