diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 505ccc1..78fd9bb 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -3,14 +3,27 @@ updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
- interval: "weekly"
+ interval: "monthly"
day: "monday"
time: "06:00"
- timezone: "UTC"
+ timezone: "Etc/UTC"
groups:
- maven-dependencies:
+ java-test-dependencies:
+ patterns:
+ - "org.junit.jupiter:*"
+ maven-build-plugins:
+ patterns:
+ - "org.apache.maven.plugins:*"
+ - "org.owasp:dependency-check-maven"
+ - "org.sonatype.plugins:nexus-staging-maven-plugin"
+ java-production-dependencies:
patterns:
- "*"
+ exclude-patterns:
+ - "org.junit.jupiter:*"
+ - "org.apache.maven.plugins:*"
+ - "org.owasp:dependency-check-maven"
+ - "org.sonatype.plugins:nexus-staging-maven-plugin"
- package-ecosystem: "github-actions"
directory: "/" # even for `.github/workflows`
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1a0570b..115aa2e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,7 +8,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v4
- - uses: actions/setup-java@v3
+ - uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index c034e1b..d587876 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -13,12 +13,13 @@ jobs:
analyse:
name: Analyse
runs-on: ubuntu-latest
- if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
+ # dependeabot has on push events only read-only access, but codeql requires write access
+ if: ${{ !(github.actor == 'dependabot[bot]' && contains(fromJSON('["push"]'), github.event_name)) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- - uses: actions/setup-java@v3
+ - uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
diff --git a/.github/workflows/publish-central.yml b/.github/workflows/publish-central.yml
index 82a7b01..7e8c25d 100644
--- a/.github/workflows/publish-central.yml
+++ b/.github/workflows/publish-central.yml
@@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
with:
ref: "refs/tags/${{ github.event.inputs.tag }}"
- - uses: actions/setup-java@v3
+ - uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
diff --git a/.github/workflows/publish-github.yml b/.github/workflows/publish-github.yml
index 8233d08..2caf761 100644
--- a/.github/workflows/publish-github.yml
+++ b/.github/workflows/publish-github.yml
@@ -8,7 +8,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
steps:
- uses: actions/checkout@v4
- - uses: actions/setup-java@v3
+ - uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
diff --git a/pom.xml b/pom.xml
index 72f7ed9..25f9040 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,17 +42,15 @@
1.3.0
2.0.0-alpha
- 1.3.2
+ 1.3.3
1.3.6
- 32.1.3-jre
2.0.9
- 3.13.0
- 5.10.0
+ 5.10.1
- 8.4.0
+ 8.4.2
1.6.8
@@ -67,11 +65,6 @@
slf4j-api
${slf4j.version}
-
- com.google.guava
- guava
- ${guava.version}
-
de.swiesend
secret-service
@@ -82,12 +75,6 @@
kdewallet
${kdewallet.version}
-
-
- org.apache.commons
- commons-lang3
- ${commons-lang3.version}
-
org.purejava
@@ -118,7 +105,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.1.2
+ 3.2.1
org.apache.maven.plugins
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
index 6116212..9ec0149 100644
--- a/src/main/java/module-info.java
+++ b/src/main/java/module-info.java
@@ -9,8 +9,6 @@
module org.cryptomator.integrations.linux {
requires org.cryptomator.integrations.api;
requires org.slf4j;
- requires com.google.common;
- requires org.apache.commons.lang3;
requires org.freedesktop.dbus;
requires org.purejava.appindicator;
requires org.purejava.kwallet;
diff --git a/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java b/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java
index 5478199..52e0771 100644
--- a/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java
+++ b/src/main/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccess.java
@@ -1,10 +1,10 @@
package org.cryptomator.linux.keychain;
-import com.google.common.base.Preconditions;
import org.cryptomator.integrations.common.OperatingSystem;
import org.cryptomator.integrations.common.Priority;
import org.cryptomator.integrations.keychain.KeychainAccessException;
import org.cryptomator.integrations.keychain.KeychainAccessProvider;
+import org.cryptomator.linux.util.CheckUtil;
import org.freedesktop.dbus.connections.impl.DBusConnection;
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder;
import org.freedesktop.dbus.exceptions.DBusConnectionException;
@@ -49,25 +49,25 @@ public boolean isLocked() {
@Override
public void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
- Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
+ CheckUtil.checkState(wallet.isPresent(), "Keychain not supported.");
wallet.get().storePassphrase(key, passphrase);
}
@Override
public char[] loadPassphrase(String key) throws KeychainAccessException {
- Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
+ CheckUtil.checkState(wallet.isPresent(), "Keychain not supported.");
return wallet.get().loadPassphrase(key);
}
@Override
public void deletePassphrase(String key) throws KeychainAccessException {
- Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
+ CheckUtil.checkState(wallet.isPresent(), "Keychain not supported.");
wallet.get().deletePassphrase(key);
}
@Override
public void changePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
- Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
+ CheckUtil.checkState(wallet.isPresent(), "Keychain not supported.");
wallet.get().changePassphrase(key, passphrase);
}
@@ -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/revealpath/DBusSendRevealPathService.java b/src/main/java/org/cryptomator/linux/revealpath/DBusSendRevealPathService.java
index 533a8e5..39529ff 100644
--- a/src/main/java/org/cryptomator/linux/revealpath/DBusSendRevealPathService.java
+++ b/src/main/java/org/cryptomator/linux/revealpath/DBusSendRevealPathService.java
@@ -1,6 +1,5 @@
package org.cryptomator.linux.revealpath;
-import com.google.common.base.Preconditions;
import org.cryptomator.integrations.revealpath.RevealFailedException;
import org.cryptomator.integrations.revealpath.RevealPathService;
@@ -91,7 +90,9 @@ public boolean isSupported() {
* @throws IOException if the Inputer reader on the process output cannot be created
*/
private boolean parseOutputForFileManagerInterface(Process fileManager1Process) throws IOException {
- Preconditions.checkState(!fileManager1Process.isAlive());
+ if( fileManager1Process.isAlive()) {
+ throw new IllegalArgumentException("Process " + fileManager1Process + " must be terminated to read output.");
+ }
try (var reader = fileManager1Process.inputReader(StandardCharsets.UTF_8)) {
return reader.lines().map(String::trim).anyMatch(FILEMANAGER1_XML_ELEMENT::equals);
}
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);
}
diff --git a/src/main/java/org/cryptomator/linux/util/CheckUtil.java b/src/main/java/org/cryptomator/linux/util/CheckUtil.java
new file mode 100644
index 0000000..02cc829
--- /dev/null
+++ b/src/main/java/org/cryptomator/linux/util/CheckUtil.java
@@ -0,0 +1,26 @@
+package org.cryptomator.linux.util;
+
+public class CheckUtil {
+
+
+ /**
+ * Ensures the truth of an expression involving the state of the calling instance, but not
+ * involving any parameters to the calling method.
+ *
+ * @param expression a boolean expression
+ * @param errorMessage the exception message to use if the check fails; will be converted to a
+ * string using {@link String#valueOf(Object)}
+ * @throws IllegalStateException if {@code expression} is false
+ */
+ public static void checkState(boolean expression, String errorMessage) {
+ if (!expression) {
+ throw new IllegalStateException(errorMessage);
+ }
+ }
+
+ public static void checkState(boolean expression) {
+ if (!expression) {
+ throw new IllegalStateException();
+ }
+ }
+}