diff --git a/main/commons/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java b/main/commons/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java index 89fd73203..0bf39f669 100644 --- a/main/commons/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java +++ b/main/commons/src/main/java/org/cryptomator/common/vaults/DokanyVolume.java @@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory; import javax.inject.Inject; import javax.inject.Named; -import java.util.SortedSet; import java.util.concurrent.ExecutorService; public class DokanyVolume extends AbstractVolume { @@ -42,7 +41,6 @@ public class DokanyVolume extends AbstractVolume { @Override public void mount(CryptoFileSystem fs, String mountFlags) throws InvalidMountPointException, VolumeException { this.mountPoint = determineMountPoint(); - String mountName = vaultSettings.mountName().get(); try { this.mount = mountFactory.mount(fs.getPath("/"), mountPoint, vaultSettings.mountName().get(), FS_TYPE_NAME, mountFlags.strip()); } catch (MountFailedException e) { @@ -62,8 +60,18 @@ public class DokanyVolume extends AbstractVolume { } @Override - public void unmount() { - mount.close(); + public void unmount() throws VolumeException { + try { + mount.unmount(); + } catch (IllegalStateException e) { + throw new VolumeException("Unmount Failed.", e); + } + cleanupMountPoint(); + } + + @Override + public void unmountForced() { + mount.close(); //TODO: with next dokany-nio-release, change this to unmountForced() cleanupMountPoint(); }