Skip to content

Commit

Permalink
Improve error reporting for https access when quarkus.ssl.native=false
Browse files Browse the repository at this point in the history
Removing the catch for `com.oracle.svm.core.jdk.UnsupportedFeatureError`
as it appears like it's never caught any more.
  • Loading branch information
zakkak committed Sep 6, 2022
1 parent 382e1d1 commit 318b1fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/native-and-ssl.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ The native executable tests will fail with the following error:

[source]
----
Caused by: java.net.MalformedURLException: Accessing an URL protocol that was not enabled. The URL protocol https is supported but not enabled by default. It must be enabled by adding the --enable-url-protocols=https option to the native-image command..
Caused by: java.lang.IllegalArgumentException: https://stage.code.quarkus.io/api requires SSL support but it is disabled. You probably have set quarkus.ssl.native to false.
----

This error is the one you obtain when trying to use SSL while it was not explicitly enabled in your native executable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,12 @@ private void configureBaseUrl(RestClientBuilder builder) {
try {
builder.baseUrl(new URL(baseUrl));
} catch (MalformedURLException e) {
throw new IllegalArgumentException("The value of URL was invalid " + baseUrl, e);
} catch (Exception e) {
if ("com.oracle.svm.core.jdk.UnsupportedFeatureError".equals(e.getClass().getCanonicalName())) {
if (e.getMessage().contains(
"It must be enabled by adding the --enable-url-protocols=https option to the native-image command")) {
throw new IllegalArgumentException(baseUrl
+ " requires SSL support but it is disabled. You probably have set quarkus.ssl.native to false.");
}
throw e;
throw new IllegalArgumentException("The value of URL was invalid " + baseUrl, e);
}
}

Expand Down

0 comments on commit 318b1fc

Please sign in to comment.