From b536bd3e0909d26553a2e754a084823b54b41d0c Mon Sep 17 00:00:00 2001 From: JaniruTEC <52893617+JaniruTEC@users.noreply.github.com> Date: Tue, 25 Jul 2023 15:33:16 +0200 Subject: [PATCH] Applied suggestions from code review Added exception to method signature Renamed enum constant See: https://github.com/cryptomator/cryptomator/pull/2996#discussion_r1273497818 https://github.com/cryptomator/cryptomator/pull/2996#discussion_r1273499227 --- .../cryptomator/common/mount/MountWithinParentUtil.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/cryptomator/common/mount/MountWithinParentUtil.java b/src/main/java/org/cryptomator/common/mount/MountWithinParentUtil.java index 39d6a9479..b632923a8 100644 --- a/src/main/java/org/cryptomator/common/mount/MountWithinParentUtil.java +++ b/src/main/java/org/cryptomator/common/mount/MountWithinParentUtil.java @@ -25,7 +25,7 @@ public final class MountWithinParentUtil { var mpState = getMountPointState(mountPoint); var hideExists = Files.exists(hideaway, LinkOption.NOFOLLOW_LINKS); - if (mpState == MountPointState.JUNCTION) { + if (mpState == MountPointState.BROKEN_JUNCTION) { LOG.info("Mountpoint \"{}\" is still a junction. Deleting it.", mountPoint); Files.delete(mountPoint); //Throws if mountPoint is also a non-empty folder mpState = MountPointState.NOT_EXISTING; @@ -67,7 +67,7 @@ public final class MountWithinParentUtil { } //visible for testing - static MountPointState getMountPointState(Path path) throws IOException { + static MountPointState getMountPointState(Path path) throws IOException, IllegalMountPointException { if (Files.notExists(path, LinkOption.NOFOLLOW_LINKS)) { return MountPointState.NOT_EXISTING; } @@ -79,7 +79,7 @@ public final class MountWithinParentUtil { if (Files.exists(path /* FOLLOW_LINKS */)) { //Both junction and target exist throw new MountPointInUseException(path); } - return MountPointState.JUNCTION; + return MountPointState.BROKEN_JUNCTION; } //visible for testing @@ -89,7 +89,7 @@ public final class MountWithinParentUtil { EMPTY_DIR, - JUNCTION; + BROKEN_JUNCTION; }