catch unchecked exceptions when checking whether linux keychain is accessible

fixes #950, fixes #952, fixes #954
This commit is contained in:
Sebastian Stenzel
2019-08-17 10:43:33 +02:00
parent 7de8e180dc
commit c287294890
2 changed files with 3 additions and 1 deletions

View File

@@ -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();

View File

@@ -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;
}
}