ammachado commented on code in PR #24541:
URL: https://github.com/apache/camel/pull/24541#discussion_r3548779295
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportCamelMain.java:
##########
@@ -287,13 +287,13 @@ protected Set<String> resolveDependencies(Path settings,
Path profile) throws Ex
Properties prop = new CamelCaseOrderedProperties();
RuntimeUtil.loadProperties(prop, profile);
// if metrics is defined then include camel-micrometer-prometheus
for camel-main runtime
- if (prop.getProperty("camel.metrics.enabled") != null
- || prop.getProperty("camel.management.metricsEnabled") !=
null
- || prop.getProperty("camel.server.metricsEnabled") !=
null) {
+ if (prop.containsKey("camel.metrics.enabled")
Review Comment:
Good catch. Rather than reverting the call site, I fixed the root
inconsistency: `CamelCaseOrderedProperties` overrode `get`/`getProperty` with
the camelCase/dash fallback but left `containsKey` doing exact-match only.
I added a `containsKey` override to `CamelCaseOrderedProperties` that
applies the same fallback (key as-is, then `dashToCamelCase`, then
`camelCaseToDash`), so it stays consistent with `getProperty` and
`ExportCamelMain`'s presence checks now match dash-style keys like
`camel.management.metrics-enabled`. Only `containsKey` needs this since values
are never transformed.
I also reviewed all `BaseOrderedProperties` descendants: `OrderedProperties`
(no read overrides) and `OrderedLocationProperties` (only `clear`/`remove`
overrides, no key transformation on read) need no containment changes.
Added a regression test (`testContainsKeyCamelCaseAndDashFallback`) covering
both storage-as-dash/lookup-as-camelCase and the reverse.
_Claude Code on behalf of ammachado_
--
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]