mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-09-20 15:04:23 +00:00
Merge branch 'develop' into feature/vault-format-8
This commit is contained in:
@@ -12,7 +12,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 14
|
java-version: 16
|
||||||
- uses: actions/cache@v1
|
- uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
path: ~/.m2/repository
|
||||||
@@ -28,10 +28,10 @@ jobs:
|
|||||||
if: github.repository == 'cryptomator/cryptomator'
|
if: github.repository == 'cryptomator/cryptomator'
|
||||||
run: |
|
run: |
|
||||||
curl -o ~/codacy-coverage-reporter.jar https://repo.maven.apache.org/maven2/com/codacy/codacy-coverage-reporter/7.1.0/codacy-coverage-reporter-7.1.0-assembly.jar
|
curl -o ~/codacy-coverage-reporter.jar https://repo.maven.apache.org/maven2/com/codacy/codacy-coverage-reporter/7.1.0/codacy-coverage-reporter-7.1.0-assembly.jar
|
||||||
$JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar report -l Java -r main/commons/target/site/jacoco/jacoco.xml --partial
|
$JAVA_HOME/bin/java --illegal-access=permit -jar ~/codacy-coverage-reporter.jar report -l Java -r main/commons/target/site/jacoco/jacoco.xml --partial
|
||||||
$JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar report -l Java -r main/ui/target/site/jacoco/jacoco.xml --partial
|
$JAVA_HOME/bin/java --illegal-access=permit -jar ~/codacy-coverage-reporter.jar report -l Java -r main/ui/target/site/jacoco/jacoco.xml --partial
|
||||||
$JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar report -l Java -r main/launcher/target/site/jacoco/jacoco.xml --partial
|
$JAVA_HOME/bin/java --illegal-access=permit -jar ~/codacy-coverage-reporter.jar report -l Java -r main/launcher/target/site/jacoco/jacoco.xml --partial
|
||||||
$JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar final
|
$JAVA_HOME/bin/java --illegal-access=permit -jar ~/codacy-coverage-reporter.jar final
|
||||||
env:
|
env:
|
||||||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||||
- name: Assemble buildkit-linux.zip
|
- name: Assemble buildkit-linux.zip
|
||||||
|
|||||||
Generated
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="false" project-jdk-name="14" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="16" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -65,7 +65,7 @@ For more information on the security details visit [cryptomator.org](https://doc
|
|||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
* JDK 14 (e.g. adoptopenjdk)
|
* JDK 16 (e.g. adoptopenjdk)
|
||||||
* Maven 3
|
* Maven 3
|
||||||
* Optional: OS-dependent build tools for native packaging (see [Windows](https://github.com/cryptomator/cryptomator-win), [OS X](https://github.com/cryptomator/cryptomator-osx), [Linux](https://github.com/cryptomator/builder-containers))
|
* Optional: OS-dependent build tools for native packaging (see [Windows](https://github.com/cryptomator/cryptomator-win), [OS X](https://github.com/cryptomator/cryptomator-osx), [Linux](https://github.com/cryptomator/builder-containers))
|
||||||
|
|
||||||
|
|||||||
@@ -50,10 +50,12 @@ public abstract class CommonsModule {
|
|||||||
@Named("licensePublicKey")
|
@Named("licensePublicKey")
|
||||||
static String provideLicensePublicKey() {
|
static String provideLicensePublicKey() {
|
||||||
// in PEM format without the dash-escaped begin/end lines
|
// in PEM format without the dash-escaped begin/end lines
|
||||||
return "MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQB7NfnqiZbg2KTmoflmZ71PbXru7oW" //
|
return """
|
||||||
+ "fmnV2yv3eDjlDfGruBrqz9TtXBZV/eYWt31xu1osIqaT12lKBvZ511aaAkIBeOEV" //
|
MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQB7NfnqiZbg2KTmoflmZ71PbXru7oW\
|
||||||
+ "gwcBIlJr6kUw7NKzeJt7r2rrsOyQoOG2nWc/Of/NBqA3mIZRHk5Aq1YupFdD26QE" //
|
fmnV2yv3eDjlDfGruBrqz9TtXBZV/eYWt31xu1osIqaT12lKBvZ511aaAkIBeOEV\
|
||||||
+ "r0DzRyj4ixPIt38CQB8=";
|
gwcBIlJr6kUw7NKzeJt7r2rrsOyQoOG2nWc/Of/NBqA3mIZRHk5Aq1YupFdD26QE\
|
||||||
|
r0DzRyj4ixPIt38CQB8=\
|
||||||
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ class LicenseChecker {
|
|||||||
try {
|
try {
|
||||||
byte[] keyBytes = BaseEncoding.base64().decode(pemEncodedPublicKey);
|
byte[] keyBytes = BaseEncoding.base64().decode(pemEncodedPublicKey);
|
||||||
PublicKey key = KeyFactory.getInstance("EC").generatePublic(new X509EncodedKeySpec(keyBytes));
|
PublicKey key = KeyFactory.getInstance("EC").generatePublic(new X509EncodedKeySpec(keyBytes));
|
||||||
if (key instanceof ECPublicKey) {
|
if (key instanceof ECPublicKey k) {
|
||||||
return (ECPublicKey) key;
|
return k;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Key not an EC public key.");
|
throw new IllegalStateException("Key not an EC public key.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,8 +173,7 @@ public class VaultSettings {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof VaultSettings && obj.getClass().equals(this.getClass())) {
|
if (obj instanceof VaultSettings other && obj.getClass().equals(this.getClass())) {
|
||||||
VaultSettings other = (VaultSettings) obj;
|
|
||||||
return Objects.equals(this.id, other.id);
|
return Objects.equals(this.id, other.id);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -369,8 +369,7 @@ public class Vault {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof Vault && obj.getClass().equals(this.getClass())) {
|
if (obj instanceof Vault other && obj.getClass().equals(this.getClass())) {
|
||||||
final Vault other = (Vault) obj;
|
|
||||||
return Objects.equals(this.vaultSettings, other.vaultSettings);
|
return Objects.equals(this.vaultSettings, other.vaultSettings);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+2
-2
@@ -22,10 +22,10 @@ class VaultListChangeListener implements ListChangeListener<Vault> {
|
|||||||
public void onChanged(Change<? extends Vault> c) {
|
public void onChanged(Change<? extends Vault> c) {
|
||||||
while (c.next()) {
|
while (c.next()) {
|
||||||
if (c.wasAdded()) {
|
if (c.wasAdded()) {
|
||||||
List<VaultSettings> addedSettings = c.getAddedSubList().stream().map(Vault::getVaultSettings).collect(Collectors.toList());
|
List<VaultSettings> addedSettings = c.getAddedSubList().stream().map(Vault::getVaultSettings).toList();
|
||||||
vaultSettingsList.addAll(c.getFrom(), addedSettings);
|
vaultSettingsList.addAll(c.getFrom(), addedSettings);
|
||||||
} else if (c.wasRemoved()) {
|
} else if (c.wasRemoved()) {
|
||||||
List<VaultSettings> removedSettings = c.getRemoved().stream().map(Vault::getVaultSettings).collect(Collectors.toList());
|
List<VaultSettings> removedSettings = c.getRemoved().stream().map(Vault::getVaultSettings).toList();
|
||||||
vaultSettingsList.removeAll(removedSettings);
|
vaultSettingsList.removeAll(removedSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class VaultListManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addAll(Collection<VaultSettings> vaultSettings) {
|
private void addAll(Collection<VaultSettings> vaultSettings) {
|
||||||
Collection<Vault> vaults = vaultSettings.stream().map(this::create).collect(Collectors.toList());
|
Collection<Vault> vaults = vaultSettings.stream().map(this::create).toList();
|
||||||
vaultList.addAll(vaults);
|
vaultList.addAll(vaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class EnvironmentTest {
|
|||||||
public void testSettingsPath() {
|
public void testSettingsPath() {
|
||||||
System.setProperty("cryptomator.settingsPath", "~/.config/Cryptomator/settings.json:~/.Cryptomator/settings.json");
|
System.setProperty("cryptomator.settingsPath", "~/.config/Cryptomator/settings.json:~/.Cryptomator/settings.json");
|
||||||
|
|
||||||
List<Path> result = env.getSettingsPath().collect(Collectors.toList());
|
List<Path> result = env.getSettingsPath().toList();
|
||||||
MatcherAssert.assertThat(result, Matchers.hasSize(2));
|
MatcherAssert.assertThat(result, Matchers.hasSize(2));
|
||||||
MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/.config/Cryptomator/settings.json"), //
|
MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/.config/Cryptomator/settings.json"), //
|
||||||
Paths.get("/home/testuser/.Cryptomator/settings.json")));
|
Paths.get("/home/testuser/.Cryptomator/settings.json")));
|
||||||
@@ -43,7 +43,7 @@ class EnvironmentTest {
|
|||||||
public void testIpcPortPath() {
|
public void testIpcPortPath() {
|
||||||
System.setProperty("cryptomator.ipcPortPath", "~/.config/Cryptomator/ipcPort.bin:~/.Cryptomator/ipcPort.bin");
|
System.setProperty("cryptomator.ipcPortPath", "~/.config/Cryptomator/ipcPort.bin:~/.Cryptomator/ipcPort.bin");
|
||||||
|
|
||||||
List<Path> result = env.getIpcPortPath().collect(Collectors.toList());
|
List<Path> result = env.getIpcPortPath().toList();
|
||||||
MatcherAssert.assertThat(result, Matchers.hasSize(2));
|
MatcherAssert.assertThat(result, Matchers.hasSize(2));
|
||||||
MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/.config/Cryptomator/ipcPort.bin"), //
|
MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/.config/Cryptomator/ipcPort.bin"), //
|
||||||
Paths.get("/home/testuser/.Cryptomator/ipcPort.bin")));
|
Paths.get("/home/testuser/.Cryptomator/ipcPort.bin")));
|
||||||
@@ -54,7 +54,7 @@ class EnvironmentTest {
|
|||||||
public void testKeychainPath() {
|
public void testKeychainPath() {
|
||||||
System.setProperty("cryptomator.keychainPath", "~/AppData/Roaming/Cryptomator/keychain.json");
|
System.setProperty("cryptomator.keychainPath", "~/AppData/Roaming/Cryptomator/keychain.json");
|
||||||
|
|
||||||
List<Path> result = env.getKeychainPath().collect(Collectors.toList());
|
List<Path> result = env.getKeychainPath().toList();
|
||||||
MatcherAssert.assertThat(result, Matchers.hasSize(1));
|
MatcherAssert.assertThat(result, Matchers.hasSize(1));
|
||||||
MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/AppData/Roaming/Cryptomator/keychain.json")));
|
MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/AppData/Roaming/Cryptomator/keychain.json")));
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ class EnvironmentTest {
|
|||||||
@DisplayName("test.path.property=")
|
@DisplayName("test.path.property=")
|
||||||
public void testEmptyList() {
|
public void testEmptyList() {
|
||||||
System.setProperty("test.path.property", "");
|
System.setProperty("test.path.property", "");
|
||||||
List<Path> result = env.getPaths("test.path.property").collect(Collectors.toList());
|
List<Path> result = env.getPaths("test.path.property").toList();
|
||||||
|
|
||||||
MatcherAssert.assertThat(result, Matchers.hasSize(0));
|
MatcherAssert.assertThat(result, Matchers.hasSize(0));
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ class EnvironmentTest {
|
|||||||
@DisplayName("test.path.property=/foo/bar/test")
|
@DisplayName("test.path.property=/foo/bar/test")
|
||||||
public void testSingleAbsolutePath() {
|
public void testSingleAbsolutePath() {
|
||||||
System.setProperty("test.path.property", "/foo/bar/test");
|
System.setProperty("test.path.property", "/foo/bar/test");
|
||||||
List<Path> result = env.getPaths("test.path.property").collect(Collectors.toList());
|
List<Path> result = env.getPaths("test.path.property").toList();
|
||||||
|
|
||||||
MatcherAssert.assertThat(result, Matchers.hasSize(1));
|
MatcherAssert.assertThat(result, Matchers.hasSize(1));
|
||||||
MatcherAssert.assertThat(result, Matchers.hasItem(Paths.get("/foo/bar/test")));
|
MatcherAssert.assertThat(result, Matchers.hasItem(Paths.get("/foo/bar/test")));
|
||||||
@@ -107,7 +107,7 @@ class EnvironmentTest {
|
|||||||
@DisplayName("test.path.property=~/test")
|
@DisplayName("test.path.property=~/test")
|
||||||
public void testSingleHomeRelativePath() {
|
public void testSingleHomeRelativePath() {
|
||||||
System.setProperty("test.path.property", "~/test");
|
System.setProperty("test.path.property", "~/test");
|
||||||
List<Path> result = env.getPaths("test.path.property").collect(Collectors.toList());
|
List<Path> result = env.getPaths("test.path.property").toList();
|
||||||
|
|
||||||
MatcherAssert.assertThat(result, Matchers.hasSize(1));
|
MatcherAssert.assertThat(result, Matchers.hasSize(1));
|
||||||
MatcherAssert.assertThat(result, Matchers.hasItem(Paths.get("/home/testuser/test")));
|
MatcherAssert.assertThat(result, Matchers.hasItem(Paths.get("/home/testuser/test")));
|
||||||
@@ -117,7 +117,7 @@ class EnvironmentTest {
|
|||||||
@DisplayName("test.path.property=~/test:~/test2:/foo/bar/test")
|
@DisplayName("test.path.property=~/test:~/test2:/foo/bar/test")
|
||||||
public void testMultiplePaths() {
|
public void testMultiplePaths() {
|
||||||
System.setProperty("test.path.property", "~/test:~/test2:/foo/bar/test");
|
System.setProperty("test.path.property", "~/test:~/test2:/foo/bar/test");
|
||||||
List<Path> result = env.getPaths("test.path.property").collect(Collectors.toList());
|
List<Path> result = env.getPaths("test.path.property").toList();
|
||||||
|
|
||||||
MatcherAssert.assertThat(result, Matchers.hasSize(3));
|
MatcherAssert.assertThat(result, Matchers.hasSize(3));
|
||||||
MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/test"), //
|
MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/test"), //
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ import java.util.Optional;
|
|||||||
|
|
||||||
class LicenseCheckerTest {
|
class LicenseCheckerTest {
|
||||||
|
|
||||||
private static final String PUBLIC_KEY = "MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBgc4HZz+/fBbC7lmEww0AO3NK9wVZ" //
|
private static final String PUBLIC_KEY = """
|
||||||
+ "PDZ0VEnsaUFLEYpTzb90nITtJUcPUbvOsdZIZ1Q8fnbquAYgxXL5UgHMoywAib47" //
|
MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBgc4HZz+/fBbC7lmEww0AO3NK9wVZ\
|
||||||
+ "6MkyyYgPk0BXZq3mq4zImTRNuaU9slj9TVJ3ScT3L1bXwVuPJDzpr5GOFpaj+WwM" //
|
PDZ0VEnsaUFLEYpTzb90nITtJUcPUbvOsdZIZ1Q8fnbquAYgxXL5UgHMoywAib47\
|
||||||
+ "Al8G7CqwoJOsW7Kddns=";
|
6MkyyYgPk0BXZq3mq4zImTRNuaU9slj9TVJ3ScT3L1bXwVuPJDzpr5GOFpaj+WwM\
|
||||||
|
Al8G7CqwoJOsW7Kddns=\
|
||||||
|
""";
|
||||||
|
|
||||||
private LicenseChecker licenseChecker;
|
private LicenseChecker licenseChecker;
|
||||||
|
|
||||||
|
|||||||
+12
-7
@@ -21,13 +21,18 @@ public class SettingsJsonAdapterTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeserialize() throws IOException {
|
public void testDeserialize() throws IOException {
|
||||||
String vault1Json = "{\"id\": \"1\", \"path\": \"/vault1\", \"mountName\": \"vault1\", \"winDriveLetter\": \"X\"}";
|
String json = """
|
||||||
String vault2Json = "{\"id\": \"2\", \"path\": \"/vault2\", \"mountName\": \"vault2\", \"winDriveLetter\": \"Y\"}";
|
{
|
||||||
String json = "{\"directories\": [" + vault1Json + "," + vault2Json + "]," //
|
"directories": [
|
||||||
+ "\"checkForUpdatesEnabled\": true,"//
|
{"id": "1", "path": "/vault1", "mountName": "vault1", "winDriveLetter": "X"},
|
||||||
+ "\"port\": 8080,"//
|
{"id": "2", "path": "/vault2", "mountName": "vault2", "winDriveLetter": "Y"}
|
||||||
+ "\"numTrayNotifications\": 42,"//
|
],
|
||||||
+ "\"preferredVolumeImpl\": \"FUSE\"}";
|
"checkForUpdatesEnabled": true,
|
||||||
|
"port": 8080,
|
||||||
|
"numTrayNotifications": 42,
|
||||||
|
"preferredVolumeImpl": "FUSE"
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
|
||||||
Settings settings = adapter.fromJson(json);
|
Settings settings = adapter.fromJson(json);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class FileOpenRequestHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void openFiles(OpenFilesEvent evt) {
|
private void openFiles(OpenFilesEvent evt) {
|
||||||
Collection<Path> pathsToOpen = evt.getFiles().stream().map(File::toPath).collect(Collectors.toList());
|
Collection<Path> pathsToOpen = evt.getFiles().stream().map(File::toPath).toList();
|
||||||
AppLaunchEvent launchEvent = new AppLaunchEvent(AppLaunchEvent.EventType.OPEN_FILE, pathsToOpen);
|
AppLaunchEvent launchEvent = new AppLaunchEvent(AppLaunchEvent.EventType.OPEN_FILE, pathsToOpen);
|
||||||
tryToEnqueueFileOpenRequest(launchEvent);
|
tryToEnqueueFileOpenRequest(launchEvent);
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ class FileOpenRequestHandler {
|
|||||||
LOG.trace("Argument not a valid path: {}", str);
|
LOG.trace("Argument not a valid path: {}", str);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
}).filter(Objects::nonNull).toList();
|
||||||
if (!pathsToOpen.isEmpty()) {
|
if (!pathsToOpen.isEmpty()) {
|
||||||
AppLaunchEvent launchEvent = new AppLaunchEvent(AppLaunchEvent.EventType.OPEN_FILE, pathsToOpen);
|
AppLaunchEvent launchEvent = new AppLaunchEvent(AppLaunchEvent.EventType.OPEN_FILE, pathsToOpen);
|
||||||
tryToEnqueueFileOpenRequest(launchEvent);
|
tryToEnqueueFileOpenRequest(launchEvent);
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ public class LoggerModule {
|
|||||||
@Singleton
|
@Singleton
|
||||||
static LoggerContext provideLoggerContext() {
|
static LoggerContext provideLoggerContext() {
|
||||||
ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
|
ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();
|
||||||
if (loggerFactory instanceof LoggerContext) {
|
if (loggerFactory instanceof LoggerContext context) {
|
||||||
return (LoggerContext) loggerFactory;
|
return context;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("SLF4J not bound to Logback.");
|
throw new IllegalStateException("SLF4J not bound to Logback.");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.jdk.version>14</project.jdk.version>
|
<project.jdk.version>16</project.jdk.version>
|
||||||
|
|
||||||
<!-- cryptomator dependencies -->
|
<!-- cryptomator dependencies -->
|
||||||
<cryptomator.cryptofs.version>2.0.0-beta4</cryptomator.cryptofs.version>
|
<cryptomator.cryptofs.version>2.0.0-beta4</cryptomator.cryptofs.version>
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ public class DefaultSceneFactory implements Function<Parent, Scene> {
|
|||||||
protected void configureScene(Scene scene) {
|
protected void configureScene(Scene scene) {
|
||||||
scene.windowProperty().addListener(observable -> {
|
scene.windowProperty().addListener(observable -> {
|
||||||
Window window = scene.getWindow();
|
Window window = scene.getWindow();
|
||||||
if (window instanceof Stage) {
|
if (window instanceof Stage s) {
|
||||||
setupDefaultAccelerators(scene, (Stage) window);
|
setupDefaultAccelerators(scene, s);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ public class UnlockWorkflow extends Task<Boolean> {
|
|||||||
|
|
||||||
setOnFailed(event -> {
|
setOnFailed(event -> {
|
||||||
Throwable throwable = event.getSource().getException();
|
Throwable throwable = event.getSource().getException();
|
||||||
if (throwable instanceof InvalidMountPointException) {
|
if (throwable instanceof InvalidMountPointException e) {
|
||||||
handleInvalidMountPoint((InvalidMountPointException) throwable);
|
handleInvalidMountPoint(e);
|
||||||
} else {
|
} else {
|
||||||
handleGenericError(throwable);
|
handleGenericError(throwable);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,18 +58,22 @@ class RecoveryKeyFactoryTest {
|
|||||||
@Test
|
@Test
|
||||||
@DisplayName("validateRecoveryKey() with invalid checksum")
|
@DisplayName("validateRecoveryKey() with invalid checksum")
|
||||||
public void testValidateValidateRecoveryKeyWithInvalidCrc() {
|
public void testValidateValidateRecoveryKeyWithInvalidCrc() {
|
||||||
boolean result = inTest.validateRecoveryKey("pathway lift abuse plenty export texture gentleman landscape beyond ceiling around leaf cafe" //
|
boolean result = inTest.validateRecoveryKey("""
|
||||||
+ " charity border breakdown victory surely computer cat linger restrict infer crowd live computer true written amazed investor boot" //
|
pathway lift abuse plenty export texture gentleman landscape beyond ceiling around leaf cafe charity \
|
||||||
+ " depth left theory snow whereby terminal weekly reject happiness circuit partial cup wrong");
|
border breakdown victory surely computer cat linger restrict infer crowd live computer true written amazed \
|
||||||
|
investor boot depth left theory snow whereby terminal weekly reject happiness circuit partial cup wrong \
|
||||||
|
""");
|
||||||
Assertions.assertFalse(result);
|
Assertions.assertFalse(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("validateRecoveryKey() with valid input")
|
@DisplayName("validateRecoveryKey() with valid input")
|
||||||
public void testValidateValidateRecoveryKeyWithValidKey() {
|
public void testValidateValidateRecoveryKeyWithValidKey() {
|
||||||
boolean result = inTest.validateRecoveryKey("pathway lift abuse plenty export texture gentleman landscape beyond ceiling around leaf cafe" //
|
boolean result = inTest.validateRecoveryKey("""
|
||||||
+ " charity border breakdown victory surely computer cat linger restrict infer crowd live computer true written amazed investor boot" //
|
pathway lift abuse plenty export texture gentleman landscape beyond ceiling around leaf cafe charity \
|
||||||
+ " depth left theory snow whereby terminal weekly reject happiness circuit partial cup ad");
|
border breakdown victory surely computer cat linger restrict infer crowd live computer true written amazed \
|
||||||
|
investor boot depth left theory snow whereby terminal weekly reject happiness circuit partial cup ad \
|
||||||
|
""");
|
||||||
Assertions.assertTrue(result);
|
Assertions.assertTrue(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user