diff --git a/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java b/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java index b051c7701..c33f9d72f 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java @@ -16,6 +16,7 @@ import javafx.scene.control.ContentDisplay; import javafx.stage.Stage; import org.cryptomator.common.vaults.Vault; import org.cryptomator.common.vaults.VaultState; +import org.cryptomator.cryptofs.FileNameTooLongException; import org.cryptomator.cryptofs.common.FileSystemCapabilityChecker; import org.cryptomator.cryptofs.migration.Migrators; import org.cryptomator.cryptofs.migration.api.MigrationContinuationListener; @@ -59,6 +60,7 @@ public class MigrationRunController implements FxController { private final ErrorComponent.Builder errorComponent; private final Lazy startScene; private final Lazy successScene; + private final Lazy impossibleScene; private final ObjectBinding migrateButtonContentDisplay; private final Lazy capabilityErrorScene; private final BooleanProperty migrationButtonDisabled; @@ -67,7 +69,8 @@ public class MigrationRunController implements FxController { public NiceSecurePasswordField passwordField; @Inject - public MigrationRunController(@MigrationWindow Stage window, @MigrationWindow Vault vault, ExecutorService executor, ScheduledExecutorService scheduler, Optional keychainAccess, @Named("capabilityErrorCause") ObjectProperty missingCapability, @FxmlScene(FxmlFile.MIGRATION_START) Lazy startScene, @FxmlScene(FxmlFile.MIGRATION_SUCCESS) Lazy successScene, @FxmlScene(FxmlFile.MIGRATION_CAPABILITY_ERROR) Lazy capabilityErrorScene, ErrorComponent.Builder errorComponent) { + public MigrationRunController(@MigrationWindow Stage window, @MigrationWindow Vault vault, ExecutorService executor, ScheduledExecutorService scheduler, Optional keychainAccess, @Named("capabilityErrorCause") ObjectProperty missingCapability, @FxmlScene(FxmlFile.MIGRATION_START) Lazy startScene, @FxmlScene(FxmlFile.MIGRATION_SUCCESS) Lazy successScene, @FxmlScene(FxmlFile.MIGRATION_CAPABILITY_ERROR) Lazy capabilityErrorScene, @FxmlScene(FxmlFile.MIGRATION_IMPOSSIBLE) Lazy impossibleScene, ErrorComponent.Builder errorComponent) { + this.window = window; this.vault = vault; this.executor = executor; @@ -81,6 +84,7 @@ public class MigrationRunController implements FxController { this.capabilityErrorScene = capabilityErrorScene; this.migrationButtonDisabled = new SimpleBooleanProperty(); this.migrationProgress = new SimpleDoubleProperty(volatileMigrationProgress); + this.impossibleScene = impossibleScene; } public void initialize() { @@ -128,9 +132,14 @@ public class MigrationRunController implements FxController { vault.setState(VaultState.NEEDS_MIGRATION); }).onError(FileSystemCapabilityChecker.MissingCapabilityException.class, e -> { LOG.error("Underlying file system not supported.", e); - vault.setState(VaultState.ERROR); + vault.setState(VaultState.NEEDS_MIGRATION); missingCapability.set(e.getMissingCapability()); window.setScene(capabilityErrorScene.get()); + }).onError(FileNameTooLongException.class, e -> { // including RuntimeExceptions + LOG.error("Migration failed for because the storage device does not support long filenames.", e); + vault.setState(VaultState.NEEDS_MIGRATION); + errorComponent.cause(e).window(window).returnToScene(startScene.get()).build().showErrorScene(); + window.setScene(impossibleScene.get()); }).onError(Exception.class, e -> { // including RuntimeExceptions LOG.error("Migration failed for technical reasons.", e); vault.setState(VaultState.NEEDS_MIGRATION); @@ -150,7 +159,7 @@ public class MigrationRunController implements FxController { }; } - private MigrationContinuationListener.ContinuationResult migrationRequiresInput(MigrationContinuationListener.ContinuationEvent event){ + private MigrationContinuationListener.ContinuationResult migrationRequiresInput(MigrationContinuationListener.ContinuationEvent event) { //TODO: creating a new scene seems a little over the top, maybe stick to this scene // my suggestion is to make this quick and dirty by setting some elements unmanaged and invisible and afterwards activate them again // otherwise: We need a more abstract runController which has two subviews (run and halted), see mainWindow for example