This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 30b990f81295 Refactor: Improve REST OpenAPI endpoint startup error
messages (#26901)
30b990f81295 is described below
commit 30b990f8129564a29cb56d3a33c380261fc27b94
Author: Brijesh Thakkar <[email protected]>
AuthorDate: Tue Sep 29 17:28:44 2026 +0530
Refactor: Improve REST OpenAPI endpoint startup error messages (#26901)
* Refactor: Improve REST OpenAPI endpoint startup error messages
* style: Align multiline exception string indentation in determineHost
* Regen
---
.../camel/component/rest/openapi/RestOpenApiEndpoint.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
index c343e4fe5660..d2bfacc078ab 100644
---
a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
+++
b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java
@@ -817,12 +817,11 @@ public final class RestOpenApiEndpoint extends
DefaultEndpoint {
}
throw new IllegalStateException(
- "Unable to determine destination host for requests. The
OpenApi specification"
+ "Unable to determine destination host for requests. The
OpenAPI specification"
+ " does not specify `scheme` and
`host` parameters, the specification URI is not absolute with `http` or"
+ " `https` scheme, and no
RestConfigurations configured with `scheme`, `host` and `port` were found for `"
- + (determineComponentName() != null
- ? determineComponentName() :
"default" + "` component")
- + " and there is no global
RestConfiguration with those properties");
+ + (determineComponentName() != null ?
determineComponentName() : "default")
+ + "` component and there is no global
RestConfiguration with those properties");
}
private Set<URI> getURIs(List<Server> servers) {
@@ -1017,14 +1016,14 @@ public final class RestOpenApiEndpoint extends
DefaultEndpoint {
}
} catch (Exception e) {
throw new IllegalArgumentException(
- "The given OpenApi specification cannot be loaded from: "
+ uri, e);
+ "Failed to load OpenAPI specification from: " + uri, e);
} finally {
IOHelper.close(is);
}
// In theory there should be a message in the parse result, but it has
disappeared...
throw new IllegalArgumentException(
- "The given OpenApi specification cannot be loaded from: " +
uri);
+ "Could not deserialize OpenAPI specification from: " + uri);
}
static String pickBestScheme(final String specificationScheme, final
List<String> schemes) {