From 73554b4759873f59da777135f6a80eb1b7769c3c Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 19 Jan 2021 15:52:20 +0100 Subject: [PATCH] split WebDAV Volume mount method into servlet start and servlet mount --- .../org/cryptomator/common/vaults/WebDavVolume.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main/commons/src/main/java/org/cryptomator/common/vaults/WebDavVolume.java b/main/commons/src/main/java/org/cryptomator/common/vaults/WebDavVolume.java index fe9246085..91291752e 100644 --- a/main/commons/src/main/java/org/cryptomator/common/vaults/WebDavVolume.java +++ b/main/commons/src/main/java/org/cryptomator/common/vaults/WebDavVolume.java @@ -17,6 +17,7 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.file.Path; import java.util.Optional; +import java.util.function.Supplier; public class WebDavVolume implements Volume { @@ -40,6 +41,11 @@ public class WebDavVolume implements Volume { @Override public void mount(CryptoFileSystem fs, String mountFlags) throws VolumeException { + startServlet(fs); + mountServlet(); + } + + private void startServlet(CryptoFileSystem fs){ if (server == null) { server = serverProvider.get(); } @@ -50,10 +56,9 @@ public class WebDavVolume implements Volume { String urlConformMountName = acceptable.negate().collapseFrom(vaultSettings.mountName().get(), '_'); servlet = server.createWebDavServlet(fs.getPath("/"), vaultSettings.getId() + "/" + urlConformMountName); servlet.start(); - mount(); } - private void mount() throws VolumeException { + private void mountServlet() throws VolumeException { if (servlet == null) { throw new IllegalStateException("Mounting requires unlocked WebDAV servlet."); } @@ -65,7 +70,6 @@ public class WebDavVolume implements Volume { try { this.mount = servlet.mount(mountParams); // might block this thread for a while } catch (Mounter.CommandFailedException e) { - e.printStackTrace(); throw new VolumeException(e); } }