gnodet-bot commented on code in PR #26766:
URL: https://github.com/apache/camel/pull/26766#discussion_r4081773237
##########
components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenApiEndpoint.java:
##########
@@ -807,12 +807,11 @@ String determineHost(final OpenAPI openApi, Operation
operation) {
}
throw new IllegalStateException(
- "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 `"
+ "Unable to determine destination host for requests. The
OpenAPI specification"
+ + " does not specify an absolute URL
in 'servers' (found relative or default path), and no 'host'"
+ + " parameter was configured on the
endpoint, component, or RestConfiguration for `"
+ (determineComponentName() != null
- ? determineComponentName() :
"default" + "` component")
- + " and there is no global
RestConfiguration with those properties");
+ ? determineComponentName() :
"default" + "` component"));
Review Comment:
🔧 **Pre-existing operator-precedence nit — good moment to fix while touching
this line.**
Java's `+` binds tighter than `?:`, so `"default" + "\` component"`
evaluates first in the false branch.
Effect:
- `determineComponentName() == null` → `...for \`default\` component` ✅
(correct)
- `determineComponentName() != null` → `...for \`<name>` ✗ (missing `` `
component`` suffix)
The bug was pre-existing in the original code, but the PR already rewrites
the surrounding message strings — wrapping the whole ternary in parens would
fix it cleanly:
```suggestion
? determineComponentName() :
"default") + "` component"));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]