Skip to content

Commit 73217c9

Browse files
committed
Throw cancelation.
1 parent 0cd1940 commit 73217c9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

core/src/main/java/ch/cyberduck/core/vault/JWKCallback.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@
1818
import ch.cyberduck.core.Host;
1919
import ch.cyberduck.core.LoginOptions;
2020
import ch.cyberduck.core.PasswordCallback;
21+
import ch.cyberduck.core.exception.ConnectionCanceledException;
2122
import ch.cyberduck.core.exception.LoginCanceledException;
23+
import ch.cyberduck.core.exception.UnsupportedException;
2224

2325
public interface JWKCallback extends PasswordCallback {
2426

2527
@Override
2628
JWKCredentials prompt(Host bookmark, String title, String reason, LoginOptions options) throws LoginCanceledException;
2729

28-
static JWKCallback cast(PasswordCallback callback) {
30+
static JWKCallback cast(PasswordCallback callback) throws ConnectionCanceledException {
2931
if(callback instanceof JWKCallback) {
3032
return (JWKCallback) callback;
3133
}
3234
else {
33-
throw new IllegalArgumentException("Unsupported metadata type " + callback.getClass());
35+
throw new ConnectionCanceledException(new UnsupportedException(callback.getClass().getName()));
3436
}
3537
}
3638
}

cryptomator/src/main/java/ch/cyberduck/core/cryptomator/impl/uvf/VaultMetadataUVFProvider.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* GNU General Public License for more details.
1616
*/
1717

18+
import ch.cyberduck.core.exception.ConnectionCanceledException;
19+
import ch.cyberduck.core.exception.UnsupportedException;
1820
import ch.cyberduck.core.vault.VaultMetadataProvider;
1921

2022
public interface VaultMetadataUVFProvider extends VaultMetadataProvider {
@@ -25,12 +27,12 @@ public interface VaultMetadataUVFProvider extends VaultMetadataProvider {
2527

2628
String getDirPath();
2729

28-
static VaultMetadataUVFProvider cast(VaultMetadataProvider provider) {
30+
static VaultMetadataUVFProvider cast(VaultMetadataProvider provider) throws ConnectionCanceledException {
2931
if(provider instanceof VaultMetadataUVFProvider) {
3032
return (VaultMetadataUVFProvider) provider;
3133
}
3234
else {
33-
throw new IllegalArgumentException("Unsupported metadata type " + provider.getClass());
35+
throw new ConnectionCanceledException(new UnsupportedException(provider.getClass().getName()));
3436
}
3537
}
3638
}

0 commit comments

Comments
 (0)