Skip to content

Commit bcda16b

Browse files
committed
removes unused/unnecessary dependencies
1 parent 6c00398 commit bcda16b

File tree

5 files changed

+34
-22
lines changed

5 files changed

+34
-22
lines changed

pom.xml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
<secret-service.version>2.0.0-alpha</secret-service.version>
4545
<kdewallet.version>1.3.3</kdewallet.version>
4646
<appindicator.version>1.3.6</appindicator.version>
47-
<guava.version>32.1.3-jre</guava.version>
4847
<slf4j.version>2.0.9</slf4j.version>
49-
<commons-lang3.version>3.13.0</commons-lang3.version>
5048

5149
<!-- test dependencies -->
5250
<junit.version>5.10.1</junit.version>
@@ -67,11 +65,6 @@
6765
<artifactId>slf4j-api</artifactId>
6866
<version>${slf4j.version}</version>
6967
</dependency>
70-
<dependency>
71-
<groupId>com.google.guava</groupId>
72-
<artifactId>guava</artifactId>
73-
<version>${guava.version}</version>
74-
</dependency>
7568
<dependency>
7669
<groupId>de.swiesend</groupId>
7770
<artifactId>secret-service</artifactId>
@@ -82,12 +75,6 @@
8275
<artifactId>kdewallet</artifactId>
8376
<version>${kdewallet.version}</version>
8477
</dependency>
85-
<!-- Apache Commons -->
86-
<dependency>
87-
<groupId>org.apache.commons</groupId>
88-
<artifactId>commons-lang3</artifactId>
89-
<version>${commons-lang3.version}</version>
90-
</dependency>
9178
<!-- Java bindings for appindicator -->
9279
<dependency>
9380
<groupId>org.purejava</groupId>

src/main/java/module-info.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
module org.cryptomator.integrations.linux {
1010
requires org.cryptomator.integrations.api;
1111
requires org.slf4j;
12-
requires com.google.common;
13-
requires org.apache.commons.lang3;
1412
requires org.freedesktop.dbus;
1513
requires org.purejava.appindicator;
1614
requires org.purejava.kwallet;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package org.cryptomator.linux.keychain;
22

3-
import com.google.common.base.Preconditions;
43
import org.cryptomator.integrations.common.OperatingSystem;
54
import org.cryptomator.integrations.common.Priority;
65
import org.cryptomator.integrations.keychain.KeychainAccessException;
76
import org.cryptomator.integrations.keychain.KeychainAccessProvider;
7+
import org.cryptomator.linux.util.CheckUtil;
88
import org.freedesktop.dbus.connections.impl.DBusConnection;
99
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder;
1010
import org.freedesktop.dbus.exceptions.DBusConnectionException;
@@ -49,25 +49,25 @@ public boolean isLocked() {
4949

5050
@Override
5151
public void storePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
52-
Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
52+
CheckUtil.checkState(wallet.isPresent(), "Keychain not supported.");
5353
wallet.get().storePassphrase(key, passphrase);
5454
}
5555

5656
@Override
5757
public char[] loadPassphrase(String key) throws KeychainAccessException {
58-
Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
58+
CheckUtil.checkState(wallet.isPresent(), "Keychain not supported.");
5959
return wallet.get().loadPassphrase(key);
6060
}
6161

6262
@Override
6363
public void deletePassphrase(String key) throws KeychainAccessException {
64-
Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
64+
CheckUtil.checkState(wallet.isPresent(), "Keychain not supported.");
6565
wallet.get().deletePassphrase(key);
6666
}
6767

6868
@Override
6969
public void changePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
70-
Preconditions.checkState(wallet.isPresent(), "Keychain not supported.");
70+
CheckUtil.checkState(wallet.isPresent(), "Keychain not supported.");
7171
wallet.get().changePassphrase(key, passphrase);
7272
}
7373

src/main/java/org/cryptomator/linux/revealpath/DBusSendRevealPathService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.cryptomator.linux.revealpath;
22

3-
import com.google.common.base.Preconditions;
43
import org.cryptomator.integrations.revealpath.RevealFailedException;
54
import org.cryptomator.integrations.revealpath.RevealPathService;
65

@@ -91,7 +90,9 @@ public boolean isSupported() {
9190
* @throws IOException if the Inputer reader on the process output cannot be created
9291
*/
9392
private boolean parseOutputForFileManagerInterface(Process fileManager1Process) throws IOException {
94-
Preconditions.checkState(!fileManager1Process.isAlive());
93+
if( fileManager1Process.isAlive()) {
94+
throw new IllegalArgumentException("Process " + fileManager1Process + " must be terminated to read output.");
95+
}
9596
try (var reader = fileManager1Process.inputReader(StandardCharsets.UTF_8)) {
9697
return reader.lines().map(String::trim).anyMatch(FILEMANAGER1_XML_ELEMENT::equals);
9798
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.cryptomator.linux.util;
2+
3+
public class CheckUtil {
4+
5+
6+
/**
7+
* Ensures the truth of an expression involving the state of the calling instance, but not
8+
* involving any parameters to the calling method.
9+
*
10+
* @param expression a boolean expression
11+
* @param errorMessage the exception message to use if the check fails; will be converted to a
12+
* string using {@link String#valueOf(Object)}
13+
* @throws IllegalStateException if {@code expression} is false
14+
*/
15+
public static void checkState(boolean expression, String errorMessage) {
16+
if (!expression) {
17+
throw new IllegalStateException(errorMessage);
18+
}
19+
}
20+
21+
public static void checkState(boolean expression) {
22+
if (!expression) {
23+
throw new IllegalStateException();
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)