mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-18 18:51:26 +00:00
Removed MountPointPreparationException
See: https://github.com/cryptomator/cryptomator/pull/3001#discussion_r1263572178
This commit is contained in:
@@ -5,8 +5,6 @@ import java.nio.file.Path;
|
||||
/**
|
||||
* Indicates that validation or preparation of a mountpoint failed due to a configuration error or an invalid system state.<br>
|
||||
* Instances of this exception are usually caught and displayed to the user in an appropriate fashion, e.g. by {@link org.cryptomator.ui.unlock.UnlockInvalidMountPointController UnlockInvalidMountPointController.}
|
||||
*
|
||||
* @see MountPointPreparationException MountPointPreparationException for wrapping exceptions which occur while preparing the mountpoint.
|
||||
*/
|
||||
public class IllegalMountPointException extends IllegalArgumentException {
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package org.cryptomator.common.mount;
|
||||
|
||||
/**
|
||||
* Used for wrapping exceptions which occur while preparing the mountpoint.<br>
|
||||
* Instances of this exception are usually treated as generic error.
|
||||
*
|
||||
* @see IllegalMountPointException IllegalMountPointException for indicating configuration errors.
|
||||
*/
|
||||
public class MountPointPreparationException extends RuntimeException {
|
||||
|
||||
public MountPointPreparationException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public MountPointPreparationException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.LinkOption;
|
||||
@@ -19,7 +20,7 @@ public final class MountWithinParentUtil {
|
||||
|
||||
private MountWithinParentUtil() {}
|
||||
|
||||
static void prepareParentNoMountPoint(Path mountPoint) throws IllegalMountPointException, MountPointPreparationException {
|
||||
static void prepareParentNoMountPoint(Path mountPoint) throws IllegalMountPointException {
|
||||
Path hideaway = getHideaway(mountPoint);
|
||||
var mpExists = Files.exists(mountPoint, LinkOption.NOFOLLOW_LINKS);
|
||||
var hideExists = Files.exists(hideaway, LinkOption.NOFOLLOW_LINKS);
|
||||
@@ -37,7 +38,7 @@ public final class MountWithinParentUtil {
|
||||
Files.setAttribute(hideaway, WIN_HIDDEN_ATTR, true, LinkOption.NOFOLLOW_LINKS);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new MountPointPreparationException(e);
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
} else { //only mountpoint exists
|
||||
try {
|
||||
@@ -57,10 +58,10 @@ public final class MountWithinParentUtil {
|
||||
attempts++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new MountPointPreparationException(e);
|
||||
throw new UncheckedIOException(e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new MountPointPreparationException(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user