浏览代码

Removed MountPointPreparationException

See: https://github.com/cryptomator/cryptomator/pull/3001#discussion_r1263572178
JaniruTEC 2 年之前
父节点
当前提交
c3ac043c68

+ 0 - 2
src/main/java/org/cryptomator/common/mount/IllegalMountPointException.java

@@ -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 {
 

+ 0 - 18
src/main/java/org/cryptomator/common/mount/MountPointPreparationException.java

@@ -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 - 4
src/main/java/org/cryptomator/common/mount/MountWithinParentUtil.java

@@ -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);
 			}
 		}
 	}