etzel-mes opened a new pull request, #28775:
URL: https://github.com/apache/camel/pull/28775

   # Description
   
   JIRA: CAMEL-26439 (filed by me as mardonius, with a JBang reproducer).
   
   **What went wrong.** `DefaultComponent.setProperties` binds endpoint options 
with `ignoreCase`, and the generated configurers then switch on 
`name.toLowerCase()`. `String.toLowerCase()` uses the JVM default locale: under 
`tr` and `az` it maps `I` to the dotless `ı`, so `clientId` becomes `clientıd`, 
matches no case label, and the configurer returns false. An option the 
reflection fallback cannot reach then fails the route: on 4.23.0 with 
`-Duser.language=tr`, `paho-mqtt5:demo?clientId=demo1` fails at route creation 
with `There are 1 parameters that couldn't be set on the endpoint`, while 
`log:demo?showExchangeId=true` still works through the reflection fallback. Of 
all ISO languages on JDK 21, `tr` and `az` are the only ones that change the 
case of ASCII option names.
   
   The templates also changed case at build time with the default locale, so 
the generated sources depended on the build machine: generated under `tr`, 
`property-configurer.vm` emits `case "itemıd":` and `target.setİtemId(...)`. 
Before the move to velocity templates (CAMEL-19779, fb57f363db6) the generator 
capitalized with `Character.toUpperCase`, which is locale independent; the 
templates use `String.toUpperCase()`.
   
   **The change.**
   
   - `property-configurer.vm`: the four generated switches use 
`name.toLowerCase(Locale.ROOT)`, as the `String.toLowerCase()` javadoc 
recommends for locale-insensitive strings.
   - `AbstractGeneratorMojo.velocity` puts `Locale.ROOT` into every template 
context as `$rootLocale`; the 18 build-time case conversions in five templates 
use it, and the 13 in the plugin's Java code use `Locale.ROOT`.
   - The hand-written `configure` switches of the bean, jsonpath, xpath and 
xquery languages had the same `name.toLowerCase()` and use `Locale.ROOT`.
   
   Of the 1,241 files, 21 are hand-written (5 templates, 10 plugin classes, 4 
languages, 2 tests); the other 1,220 are regenerated configurers, including the 
two test configurers of camel-main. They differ only in the switch lines and a 
`java.util.Locale` import; the 48 configurers without options of their own 
(such as `AMQPEndpointConfigurer`) import it unused, like their other imports. 
Built under `en`, the case labels and all other generated output are unchanged.
   
   **Verification.**
   
   - `SedaConfigureTest#testConfigureIgnoreCaseLocaleIndependent` binds 
`failIfNoConsumers` with `ignoreCase` under `tr_TR`. Under `tr`, the 4.23.0 
`SedaEndpointConfigurer` returns null for `getOptionType("failIfNoConsumers", 
true)`, the regenerated one `boolean`.
   - `PackageLanguageMojoTest#theConfigurerDoesNotDependOnTheDefaultLocale` 
generates a configurer under `tr_TR`. It fails on the old template, which emits 
`itemıd`, `setİtemId` and `getİtemId`, and passes on the new one. The plugin's 
127 tests are green.
   - `camel-seda` and `camel-paho-mqtt5` generated under `tr` give the same 
sources as under `en`.
   - The JBang reproducer of the JIRA creates the paho-mqtt5 endpoint on 
4.24.0-SNAPSHOT under `tr` and then fails, as expected without a broker, with 
`Connection refused`.
   - Root build with `-Dquickly` (not `clean install -DskipTests`); 
`-Psourcecheck` on the plugin, camel-core and the four language modules.
   
   @davsclaus @gnodet could you have a look? (I cannot request reviewers.)
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   The code and tests were written with Claude Code (Claude Opus 5.5) under my 
direction; the commit carries the `Co-authored-by` trailer.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   _Claude Code on behalf of etzel-mes_
   


-- 
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]

Reply via email to