diff --git a/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java b/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java index 4d168d0..52e0771 100644 --- a/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java +++ b/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java @@ -95,11 +95,7 @@ private static DBusConnection getNewConnection() throws DBusException { } catch (DBusConnectionException | DBusExecutionException de) { LOG.warn("Connecting to SESSION bus failed.", de); LOG.warn("Falling back to SYSTEM DBus"); - try { - return DBusConnectionBuilder.forSystemBus().build(); - } catch (DBusException e) { - throw e; - } + return DBusConnectionBuilder.forSystemBus().build(); } } @@ -144,7 +140,7 @@ public char[] loadPassphrase(String key) throws KeychainAccessException { } else { LOG.debug("loadPassphrase: wallet is closed."); } - return (password.equals("")) ? null : password.toCharArray(); + return (password.isEmpty()) ? null : password.toCharArray(); } catch (RuntimeException e) { throw new KeychainAccessException("Loading the passphrase failed.", e); } diff --git a/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java b/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java index 66daabc..573d178 100644 --- a/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java +++ b/src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java @@ -31,7 +31,6 @@ public class AppindicatorTrayMenuController implements TrayMenuController { private static final Arena ARENA = Arena.global(); private MemorySegment indicator; private MemorySegment menu = gtk_menu_new(); - private Optional svgSourcePath; @CheckAvailability public static boolean isAvailable() { @@ -48,9 +47,9 @@ public void showTrayIcon(Consumer iconLoader, Runnable runnable, private void showTrayIconWithSVG(String s) { try (var arena = Arena.ofConfined()) { - svgSourcePath = Optional.ofNullable(System.getProperty(SVG_SOURCE_PROPERTY)); + var svgSourcePath = System.getProperty(SVG_SOURCE_PROPERTY); // flatpak - if (svgSourcePath.isEmpty()) { + if (svgSourcePath != null) { indicator = app_indicator_new(arena.allocateUtf8String(APP_INDICATOR_ID), arena.allocateUtf8String(s), APP_INDICATOR_CATEGORY_APPLICATION_STATUS()); @@ -60,7 +59,7 @@ private void showTrayIconWithSVG(String s) { arena.allocateUtf8String(s), APP_INDICATOR_CATEGORY_APPLICATION_STATUS(), // find tray icons theme in mounted AppImage / installed on system by ppa - arena.allocateUtf8String(svgSourcePath.get())); + arena.allocateUtf8String(svgSourcePath)); } } } @@ -105,7 +104,7 @@ private void addChildren(MemorySegment menu, List items) { } gtk_menu_shell_append(menu, gtkMenuItem); } - case SeparatorItem separatorItem -> { + case SeparatorItem _ -> { var gtkSeparator = gtk_menu_item_new(); gtk_menu_shell_append(menu, gtkSeparator); }