Serdar Gökay created CAMEL-26439:
------------------------------------

             Summary: Generated property configurers lower-case option names 
with the JVM default locale, so options with a capital I fail with "Unknown 
parameters" under a Turkish locale
                 Key: CAMEL-26439
                 URL: https://issues.apache.org/jira/browse/CAMEL-26439
             Project: Camel
          Issue Type: Bug
          Components: camel-package-maven-plugin
    Affects Versions: 4.23.0
            Reporter: Serdar Gökay


The velocity template {{property-configurer.vm}} in 
{{camel-package-maven-plugin}} generates

{code:java}
switch (ignoreCase ? name.toLowerCase() : name) {
{code}

without a locale. {{DefaultComponent.setProperties}} binds endpoint options 
with {{withIgnoreCase(true)}}, so the configurer lower-cases every option name 
with the default locale. Under {{tr}} (and {{az}}) the capital {{I}} becomes 
the dotless {{ı}}: {{clientId}} becomes {{clientıd}}, matches no case label, 
and the configurer returns false.

The same template also lower-cases the case labels at build time ({{case 
"${option.name.toLowerCase()}"}}), so the generated sources depend on the 
locale of the machine that builds Camel; {{invoke-on-header.vm}} has the same 
pattern. 14 calls in the velocity templates are affected.

Reproducer (Camel JBang 4.23.0, no broker needed):

{code:yaml}
- route:
    from:
      uri: timer:tick?repeatCount=1
      steps:
        - to: paho-mqtt5:demo?clientId=demo1&brokerUrl=tcp://127.0.0.1:1
{code}

* {{JAVA_TOOL_OPTIONS="-Duser.language=tr -Duser.country=TR" camel run 
paho.yaml}} fails at route creation: {{ResolveEndpointFailedException ... There 
are 1 parameters that couldn't be set on the endpoint}} ({{clientId}}).
* With {{-Duser.language=en -Duser.country=US}} the endpoint is created and the 
route fails later, as expected, with {{Connection refused}}.

Not every option is affected: {{log:demo?showExchangeId=true}} works under 
{{tr}}, presumably because the reflection fallback in 
{{PropertyBindingSupport}} finds the setter after the configurer misses. 
{{clientId}} lives on the paho-mqtt5 configuration object and is not found that 
way.

This is the same class of problem as CAMEL-5199 ({{ObjectHelper.capitalize}}, 
fixed in 2.10.0), now in the generated configurers.

Proposed fix: use {{toLowerCase(Locale.ROOT)}} in the velocity templates 
(runtime switch and generated case labels), regenerate the configurers, and add 
a test that binds an option with a capital I under a {{tr_TR}} default locale.

_Claude Code on behalf of etzel-mes_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to