From 46a3a4fc119948337b8a5cd67a7dbe9d7e6e370e Mon Sep 17 00:00:00 2001 From: JaniruTEC Date: Thu, 9 Dec 2021 23:10:45 +0100 Subject: [PATCH 1/3] Added error message if user tries to mount to occupied drive. Fixes #1888 --- .../mountpoint/CustomDriveLetterChooser.java | 12 +++++++++ .../mountpoint/CustomMountPointChooser.java | 2 +- .../TemporaryMountPointChooser.java | 2 +- .../common/vaults/DokanyVolume.java | 2 +- .../cryptomator/common/vaults/FuseVolume.java | 13 ++++++--- .../common/vaults/MountPointRequirement.java | 5 ++++ .../UnlockInvalidMountPointController.java | 27 ++++++++++++++----- .../cryptomator/ui/unlock/UnlockWorkflow.java | 10 +++++-- .../fxml/unlock_invalid_mount_point.fxml | 5 ++-- src/main/resources/i18n/strings.properties | 1 + 10 files changed, 62 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/cryptomator/common/mountpoint/CustomDriveLetterChooser.java b/src/main/java/org/cryptomator/common/mountpoint/CustomDriveLetterChooser.java index 1a42aa5ad..02f75d4a1 100644 --- a/src/main/java/org/cryptomator/common/mountpoint/CustomDriveLetterChooser.java +++ b/src/main/java/org/cryptomator/common/mountpoint/CustomDriveLetterChooser.java @@ -5,6 +5,9 @@ import org.cryptomator.common.settings.VaultSettings; import org.cryptomator.common.vaults.Volume; import javax.inject.Inject; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.Files; +import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Optional; @@ -27,4 +30,13 @@ class CustomDriveLetterChooser implements MountPointChooser { public Optional chooseMountPoint(Volume caller) { return this.vaultSettings.getWinDriveLetter().map(letter -> letter.charAt(0) + ":\\").map(Paths::get); } + + @Override + public boolean prepare(Volume caller, Path driveLetter) throws InvalidMountPointException { + if (!Files.notExists(driveLetter, LinkOption.NOFOLLOW_LINKS)) { + //Drive already exists OR can't be determined + throw new InvalidMountPointException(new FileAlreadyExistsException(driveLetter.toString())); + } + return false; + } } diff --git a/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java b/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java index 5f1a7fedd..a78564db4 100644 --- a/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java +++ b/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java @@ -56,7 +56,7 @@ class CustomMountPointChooser implements MountPointChooser { throw new InvalidMountPointException(new IllegalStateException("Illegal MountPointRequirement")); } default -> { - //Currently the case for "PARENT_OPT_MOUNT_POINT" + //Currently the case for "NO_PARENT_NO_MOUNT_POINT, PARENT_OPT_MOUNT_POINT" throw new InvalidMountPointException(new IllegalStateException("Not implemented")); } } diff --git a/src/main/java/org/cryptomator/common/mountpoint/TemporaryMountPointChooser.java b/src/main/java/org/cryptomator/common/mountpoint/TemporaryMountPointChooser.java index eb1d8d0b1..b119ff084 100644 --- a/src/main/java/org/cryptomator/common/mountpoint/TemporaryMountPointChooser.java +++ b/src/main/java/org/cryptomator/common/mountpoint/TemporaryMountPointChooser.java @@ -65,7 +65,7 @@ class TemporaryMountPointChooser implements MountPointChooser { throw new InvalidMountPointException(new IllegalStateException("Illegal MountPointRequirement")); } default -> { - //Currently the case for "PARENT_OPT_MOUNT_POINT" + //Currently the case for "NO_PARENT_NO_MOUNT_POINT, PARENT_OPT_MOUNT_POINT" throw new InvalidMountPointException(new IllegalStateException("Not implemented")); } } diff --git a/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java b/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java index c998761d0..64bd41edf 100644 --- a/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java +++ b/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java @@ -86,7 +86,7 @@ public class DokanyVolume extends AbstractVolume { @Override public MountPointRequirement getMountPointRequirement() { - return MountPointRequirement.EMPTY_MOUNT_POINT; + return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.NO_PARENT_NO_MOUNT_POINT : MountPointRequirement.EMPTY_MOUNT_POINT; } public static boolean isSupportedStatic() { diff --git a/src/main/java/org/cryptomator/common/vaults/FuseVolume.java b/src/main/java/org/cryptomator/common/vaults/FuseVolume.java index a1579fdaf..e3b0d2ed5 100644 --- a/src/main/java/org/cryptomator/common/vaults/FuseVolume.java +++ b/src/main/java/org/cryptomator/common/vaults/FuseVolume.java @@ -4,6 +4,7 @@ import com.google.common.collect.Iterators; import org.apache.commons.lang3.SystemUtils; import org.cryptomator.common.mountpoint.InvalidMountPointException; import org.cryptomator.common.mountpoint.MountPointChooser; +import org.cryptomator.common.settings.VaultSettings; import org.cryptomator.common.settings.VolumeImpl; import org.cryptomator.cryptofs.CryptoFileSystem; import org.cryptomator.frontend.fuse.mount.EnvironmentVariables; @@ -28,11 +29,14 @@ public class FuseVolume extends AbstractVolume { private static final Logger LOG = LoggerFactory.getLogger(FuseVolume.class); private static final Pattern NON_WHITESPACE_OR_QUOTED = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'"); // Thanks to https://stackoverflow.com/a/366532 + private final VaultSettings vaultSettings; + private Mount mount; @Inject - public FuseVolume(@Named("orderedMountPointChoosers") Iterable choosers) { + public FuseVolume(VaultSettings vaultSettings, @Named("orderedMountPointChoosers") Iterable choosers) { super(choosers); + this.vaultSettings = vaultSettings; } @Override @@ -50,7 +54,7 @@ public class FuseVolume extends AbstractVolume { .withFileNameTranscoder(mounter.defaultFileNameTranscoder()) // .build(); this.mount = mounter.mount(root, envVars, onExitAction); - } catch ( FuseMountException | FuseNotSupportedException e) { + } catch (FuseMountException | FuseNotSupportedException e) { throw new VolumeException("Unable to mount Filesystem", e); } } @@ -119,7 +123,10 @@ public class FuseVolume extends AbstractVolume { @Override public MountPointRequirement getMountPointRequirement() { - return SystemUtils.IS_OS_WINDOWS ? MountPointRequirement.PARENT_NO_MOUNT_POINT : MountPointRequirement.EMPTY_MOUNT_POINT; + if (!SystemUtils.IS_OS_WINDOWS) { + return MountPointRequirement.EMPTY_MOUNT_POINT; + } + return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.NO_PARENT_NO_MOUNT_POINT : MountPointRequirement.PARENT_NO_MOUNT_POINT; } public static boolean isSupportedStatic() { diff --git a/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java b/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java index 84a798e59..b7510e811 100644 --- a/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java +++ b/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java @@ -6,6 +6,11 @@ package org.cryptomator.common.vaults; */ public enum MountPointRequirement { + /** + * There must not be a parent folder and the actual Mountpoint must not exist. + */ + NO_PARENT_NO_MOUNT_POINT, + /** * No Mountpoint on the local filesystem required. (e.g. WebDAV) */ diff --git a/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java b/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java index fd85db988..f84842807 100644 --- a/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java +++ b/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java @@ -1,5 +1,6 @@ package org.cryptomator.ui.unlock; +import org.apache.commons.lang3.SystemUtils; import org.cryptomator.common.vaults.MountPointRequirement; import org.cryptomator.common.vaults.Vault; import org.cryptomator.ui.common.FxController; @@ -32,12 +33,24 @@ public class UnlockInvalidMountPointController implements FxController { return vault.getVaultSettings().getCustomMountPath().orElse("AUTO"); } - public boolean getMustExist() { - MountPointRequirement requirement = vault.getVolume().orElseThrow(() -> new IllegalStateException("Invalid Mountpoint without a Volume?!")).getMountPointRequirement(); - assert requirement != MountPointRequirement.NONE; //An invalid MountPoint with no required MountPoint doesn't seem sensible - assert requirement != MountPointRequirement.PARENT_OPT_MOUNT_POINT; //Not implemented anywhere (yet) - - return requirement == MountPointRequirement.EMPTY_MOUNT_POINT; + public boolean getNotExisting() { + return getMountPointRequirement() == MountPointRequirement.EMPTY_MOUNT_POINT; } -} + public boolean getExisting() { + return getMountPointRequirement() == MountPointRequirement.PARENT_NO_MOUNT_POINT; + } + + public boolean getDriveLetterOccupied() { + return getMountPointRequirement() == MountPointRequirement.NO_PARENT_NO_MOUNT_POINT; + } + + private MountPointRequirement getMountPointRequirement() { + var requirement = vault.getVolume().orElseThrow(() -> new IllegalStateException("Invalid Mountpoint without a Volume?!")).getMountPointRequirement(); + assert requirement != MountPointRequirement.NONE; //An invalid MountPoint with no required MountPoint doesn't seem sensible + assert requirement != MountPointRequirement.PARENT_OPT_MOUNT_POINT; //Not implemented anywhere (yet) + assert requirement != MountPointRequirement.NO_PARENT_NO_MOUNT_POINT || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows + + return requirement; + } +} \ No newline at end of file diff --git a/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java b/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java index 073258d80..db7b6f7d9 100644 --- a/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java +++ b/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java @@ -2,6 +2,7 @@ package org.cryptomator.ui.unlock; import com.google.common.base.Throwables; import dagger.Lazy; +import org.apache.commons.lang3.SystemUtils; import org.cryptomator.common.mountpoint.InvalidMountPointException; import org.cryptomator.common.vaults.MountPointRequirement; import org.cryptomator.common.vaults.Vault; @@ -79,9 +80,10 @@ public class UnlockWorkflow extends Task { } private void handleInvalidMountPoint(InvalidMountPointException impExc) { - MountPointRequirement requirement = vault.getVolume().orElseThrow(() -> new IllegalStateException("Invalid Mountpoint without a Volume?!", impExc)).getMountPointRequirement(); + var requirement = vault.getVolume().orElseThrow(() -> new IllegalStateException("Invalid Mountpoint without a Volume?!", impExc)).getMountPointRequirement(); assert requirement != MountPointRequirement.NONE; //An invalid MountPoint with no required MountPoint doesn't seem sensible assert requirement != MountPointRequirement.PARENT_OPT_MOUNT_POINT; //Not implemented anywhere (yet) + assert requirement != MountPointRequirement.NO_PARENT_NO_MOUNT_POINT || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows Throwable cause = impExc.getCause(); // TODO: apply https://openjdk.java.net/jeps/8213076 in future JDK versions @@ -93,7 +95,11 @@ public class UnlockWorkflow extends Task { } showInvalidMountPointScene(); } else if (cause instanceof FileAlreadyExistsException) { - LOG.error("Unlock failed. Mountpoint already exists: {}", cause.getMessage()); + if (requirement == MountPointRequirement.NO_PARENT_NO_MOUNT_POINT) { + LOG.error("Unlock failed. Drive Letter already occupied: {}", cause.getMessage()); + } else { + LOG.error("Unlock failed. Mountpoint already exists: {}", cause.getMessage()); + } showInvalidMountPointScene(); } else if (cause instanceof DirectoryNotEmptyException) { LOG.error("Unlock failed. Mountpoint not an empty directory: {}", cause.getMessage()); diff --git a/src/main/resources/fxml/unlock_invalid_mount_point.fxml b/src/main/resources/fxml/unlock_invalid_mount_point.fxml index 253ff5704..062981304 100644 --- a/src/main/resources/fxml/unlock_invalid_mount_point.fxml +++ b/src/main/resources/fxml/unlock_invalid_mount_point.fxml @@ -29,8 +29,9 @@ - - + + + diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 7b17fa791..38b8128a2 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -115,6 +115,7 @@ unlock.error.heading=Unable to unlock vault ### Invalid Mount Point unlock.error.invalidMountPoint.notExisting=Mount point "%s" is not a directory, not empty or does not exist. unlock.error.invalidMountPoint.existing=Mount point "%s" already exists or parent folder is missing. +unlock.error.invalidMountPoint.driveLetterOccupied=Drive Letter "%s" is already occupied. # Lock ## Force From 080ddbbb0196554b96a8829e367d62225447fce7 Mon Sep 17 00:00:00 2001 From: JaniruTEC Date: Tue, 18 Jan 2022 02:25:04 +0100 Subject: [PATCH 2/3] Applied changes from code review. --- .../org/cryptomator/common/vaults/MountPointRequirement.java | 2 +- src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java | 2 +- src/main/resources/i18n/strings.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java b/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java index b7510e811..cc21df03d 100644 --- a/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java +++ b/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java @@ -7,7 +7,7 @@ package org.cryptomator.common.vaults; public enum MountPointRequirement { /** - * There must not be a parent folder and the actual Mountpoint must not exist. + * The Mountpoint needs to be a filesystem root and must not exist. */ NO_PARENT_NO_MOUNT_POINT, diff --git a/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java b/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java index db7b6f7d9..1227fc9de 100644 --- a/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java +++ b/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java @@ -96,7 +96,7 @@ public class UnlockWorkflow extends Task { showInvalidMountPointScene(); } else if (cause instanceof FileAlreadyExistsException) { if (requirement == MountPointRequirement.NO_PARENT_NO_MOUNT_POINT) { - LOG.error("Unlock failed. Drive Letter already occupied: {}", cause.getMessage()); + LOG.error("Unlock failed. Drive Letter already in use: {}", cause.getMessage()); } else { LOG.error("Unlock failed. Mountpoint already exists: {}", cause.getMessage()); } diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 241c8e538..36932b877 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -116,7 +116,7 @@ unlock.error.heading=Unable to unlock vault ### Invalid Mount Point unlock.error.invalidMountPoint.notExisting=Mount point "%s" is not a directory, not empty or does not exist. unlock.error.invalidMountPoint.existing=Mount point "%s" already exists or parent folder is missing. -unlock.error.invalidMountPoint.driveLetterOccupied=Drive Letter "%s" is already occupied. +unlock.error.invalidMountPoint.driveLetterOccupied=Drive Letter "%s" is already in use. # Lock ## Force From 1641a06d650ace9fa6a1c6aa7da11804d09b9aec Mon Sep 17 00:00:00 2001 From: JaniruTEC Date: Sun, 30 Jan 2022 01:33:44 +0100 Subject: [PATCH 3/3] Renamed NO_PARENT_NO_MOUNT_POINT to UNUSED_ROOT_DIR in MountPointRequirement --- .../common/mountpoint/CustomMountPointChooser.java | 2 +- .../common/mountpoint/TemporaryMountPointChooser.java | 2 +- src/main/java/org/cryptomator/common/vaults/DokanyVolume.java | 2 +- src/main/java/org/cryptomator/common/vaults/FuseVolume.java | 2 +- .../org/cryptomator/common/vaults/MountPointRequirement.java | 2 +- .../ui/unlock/UnlockInvalidMountPointController.java | 4 ++-- src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java b/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java index a78564db4..c55ede640 100644 --- a/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java +++ b/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java @@ -56,7 +56,7 @@ class CustomMountPointChooser implements MountPointChooser { throw new InvalidMountPointException(new IllegalStateException("Illegal MountPointRequirement")); } default -> { - //Currently the case for "NO_PARENT_NO_MOUNT_POINT, PARENT_OPT_MOUNT_POINT" + //Currently the case for "UNUSED_ROOT_DIR, PARENT_OPT_MOUNT_POINT" throw new InvalidMountPointException(new IllegalStateException("Not implemented")); } } diff --git a/src/main/java/org/cryptomator/common/mountpoint/TemporaryMountPointChooser.java b/src/main/java/org/cryptomator/common/mountpoint/TemporaryMountPointChooser.java index b119ff084..bcda3d8f2 100644 --- a/src/main/java/org/cryptomator/common/mountpoint/TemporaryMountPointChooser.java +++ b/src/main/java/org/cryptomator/common/mountpoint/TemporaryMountPointChooser.java @@ -65,7 +65,7 @@ class TemporaryMountPointChooser implements MountPointChooser { throw new InvalidMountPointException(new IllegalStateException("Illegal MountPointRequirement")); } default -> { - //Currently the case for "NO_PARENT_NO_MOUNT_POINT, PARENT_OPT_MOUNT_POINT" + //Currently the case for "UNUSED_ROOT_DIR, PARENT_OPT_MOUNT_POINT" throw new InvalidMountPointException(new IllegalStateException("Not implemented")); } } diff --git a/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java b/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java index 64bd41edf..c08642073 100644 --- a/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java +++ b/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java @@ -86,7 +86,7 @@ public class DokanyVolume extends AbstractVolume { @Override public MountPointRequirement getMountPointRequirement() { - return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.NO_PARENT_NO_MOUNT_POINT : MountPointRequirement.EMPTY_MOUNT_POINT; + return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.UNUSED_ROOT_DIR : MountPointRequirement.EMPTY_MOUNT_POINT; } public static boolean isSupportedStatic() { diff --git a/src/main/java/org/cryptomator/common/vaults/FuseVolume.java b/src/main/java/org/cryptomator/common/vaults/FuseVolume.java index e3b0d2ed5..0321cfa0f 100644 --- a/src/main/java/org/cryptomator/common/vaults/FuseVolume.java +++ b/src/main/java/org/cryptomator/common/vaults/FuseVolume.java @@ -126,7 +126,7 @@ public class FuseVolume extends AbstractVolume { if (!SystemUtils.IS_OS_WINDOWS) { return MountPointRequirement.EMPTY_MOUNT_POINT; } - return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.NO_PARENT_NO_MOUNT_POINT : MountPointRequirement.PARENT_NO_MOUNT_POINT; + return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.UNUSED_ROOT_DIR : MountPointRequirement.PARENT_NO_MOUNT_POINT; } public static boolean isSupportedStatic() { diff --git a/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java b/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java index cc21df03d..deec61e1a 100644 --- a/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java +++ b/src/main/java/org/cryptomator/common/vaults/MountPointRequirement.java @@ -9,7 +9,7 @@ public enum MountPointRequirement { /** * The Mountpoint needs to be a filesystem root and must not exist. */ - NO_PARENT_NO_MOUNT_POINT, + UNUSED_ROOT_DIR, /** * No Mountpoint on the local filesystem required. (e.g. WebDAV) diff --git a/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java b/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java index f84842807..234bac65b 100644 --- a/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java +++ b/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java @@ -42,14 +42,14 @@ public class UnlockInvalidMountPointController implements FxController { } public boolean getDriveLetterOccupied() { - return getMountPointRequirement() == MountPointRequirement.NO_PARENT_NO_MOUNT_POINT; + return getMountPointRequirement() == MountPointRequirement.UNUSED_ROOT_DIR; } private MountPointRequirement getMountPointRequirement() { var requirement = vault.getVolume().orElseThrow(() -> new IllegalStateException("Invalid Mountpoint without a Volume?!")).getMountPointRequirement(); assert requirement != MountPointRequirement.NONE; //An invalid MountPoint with no required MountPoint doesn't seem sensible assert requirement != MountPointRequirement.PARENT_OPT_MOUNT_POINT; //Not implemented anywhere (yet) - assert requirement != MountPointRequirement.NO_PARENT_NO_MOUNT_POINT || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows + assert requirement != MountPointRequirement.UNUSED_ROOT_DIR || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows return requirement; } diff --git a/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java b/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java index 1227fc9de..6964c3c86 100644 --- a/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java +++ b/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java @@ -83,7 +83,7 @@ public class UnlockWorkflow extends Task { var requirement = vault.getVolume().orElseThrow(() -> new IllegalStateException("Invalid Mountpoint without a Volume?!", impExc)).getMountPointRequirement(); assert requirement != MountPointRequirement.NONE; //An invalid MountPoint with no required MountPoint doesn't seem sensible assert requirement != MountPointRequirement.PARENT_OPT_MOUNT_POINT; //Not implemented anywhere (yet) - assert requirement != MountPointRequirement.NO_PARENT_NO_MOUNT_POINT || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows + assert requirement != MountPointRequirement.UNUSED_ROOT_DIR || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows Throwable cause = impExc.getCause(); // TODO: apply https://openjdk.java.net/jeps/8213076 in future JDK versions @@ -95,7 +95,7 @@ public class UnlockWorkflow extends Task { } showInvalidMountPointScene(); } else if (cause instanceof FileAlreadyExistsException) { - if (requirement == MountPointRequirement.NO_PARENT_NO_MOUNT_POINT) { + if (requirement == MountPointRequirement.UNUSED_ROOT_DIR) { LOG.error("Unlock failed. Drive Letter already in use: {}", cause.getMessage()); } else { LOG.error("Unlock failed. Mountpoint already exists: {}", cause.getMessage());