Skip to content

Commit 0f6a426

Browse files
committed
clean up code
1 parent bcda16b commit 0f6a426

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ private static DBusConnection getNewConnection() throws DBusException {
9595
} catch (DBusConnectionException | DBusExecutionException de) {
9696
LOG.warn("Connecting to SESSION bus failed.", de);
9797
LOG.warn("Falling back to SYSTEM DBus");
98-
try {
99-
return DBusConnectionBuilder.forSystemBus().build();
100-
} catch (DBusException e) {
101-
throw e;
102-
}
98+
return DBusConnectionBuilder.forSystemBus().build();
10399
}
104100
}
105101

@@ -144,7 +140,7 @@ public char[] loadPassphrase(String key) throws KeychainAccessException {
144140
} else {
145141
LOG.debug("loadPassphrase: wallet is closed.");
146142
}
147-
return (password.equals("")) ? null : password.toCharArray();
143+
return (password.isEmpty()) ? null : password.toCharArray();
148144
} catch (RuntimeException e) {
149145
throw new KeychainAccessException("Loading the passphrase failed.", e);
150146
}

src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public class AppindicatorTrayMenuController implements TrayMenuController {
3131
private static final Arena ARENA = Arena.global();
3232
private MemorySegment indicator;
3333
private MemorySegment menu = gtk_menu_new();
34-
private Optional<String> svgSourcePath;
3534

3635
@CheckAvailability
3736
public static boolean isAvailable() {
@@ -48,9 +47,9 @@ public void showTrayIcon(Consumer<TrayIconLoader> iconLoader, Runnable runnable,
4847

4948
private void showTrayIconWithSVG(String s) {
5049
try (var arena = Arena.ofConfined()) {
51-
svgSourcePath = Optional.ofNullable(System.getProperty(SVG_SOURCE_PROPERTY));
50+
var svgSourcePath = System.getProperty(SVG_SOURCE_PROPERTY);
5251
// flatpak
53-
if (svgSourcePath.isEmpty()) {
52+
if (svgSourcePath != null) {
5453
indicator = app_indicator_new(arena.allocateUtf8String(APP_INDICATOR_ID),
5554
arena.allocateUtf8String(s),
5655
APP_INDICATOR_CATEGORY_APPLICATION_STATUS());
@@ -60,7 +59,7 @@ private void showTrayIconWithSVG(String s) {
6059
arena.allocateUtf8String(s),
6160
APP_INDICATOR_CATEGORY_APPLICATION_STATUS(),
6261
// find tray icons theme in mounted AppImage / installed on system by ppa
63-
arena.allocateUtf8String(svgSourcePath.get()));
62+
arena.allocateUtf8String(svgSourcePath));
6463
}
6564
}
6665
}
@@ -105,7 +104,7 @@ private void addChildren(MemorySegment menu, List<TrayMenuItem> items) {
105104
}
106105
gtk_menu_shell_append(menu, gtkMenuItem);
107106
}
108-
case SeparatorItem separatorItem -> {
107+
case SeparatorItem _ -> {
109108
var gtkSeparator = gtk_menu_item_new();
110109
gtk_menu_shell_append(menu, gtkSeparator);
111110
}

0 commit comments

Comments
 (0)