From 0872aec65fff6b2764ba8454f0a1157ee2e69ad3 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 15 Sep 2023 11:29:55 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Sebastian Stenzel --- .../keychain/WindowsProtectedKeychainAccess.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/cryptomator/windows/keychain/WindowsProtectedKeychainAccess.java b/src/main/java/org/cryptomator/windows/keychain/WindowsProtectedKeychainAccess.java index 333f2cb..abb71f1 100644 --- a/src/main/java/org/cryptomator/windows/keychain/WindowsProtectedKeychainAccess.java +++ b/src/main/java/org/cryptomator/windows/keychain/WindowsProtectedKeychainAccess.java @@ -182,13 +182,13 @@ Optional> loadKeychainEntries(Path keychainPath) thro try (InputStream in = Files.newInputStream(keychainPath, StandardOpenOption.READ); // Reader reader = new InputStreamReader(in, UTF_8)) { return Optional.ofNullable(JSON_MAPPER.readValue(reader, type)); - } catch (NoSuchFileException | JacksonException e) { - if (e instanceof JacksonException) { - LOG.warn("Unable to parse keychain file, overwriting existing one."); - } + } catch (NoSuchFileException e) { + return Optional.empty(); + } catch (JacksonException je) { + LOG.warn("Unable to parse keychain file, overwriting existing one."); return Optional.empty(); - } catch (IOException ioe) { - throw new KeychainAccessException("Could not read keychain from path " + keychainPath, ioe); + } catch (IOException e) { + throw new KeychainAccessException("Could not read keychain from path " + keychainPath, e); } }