Skip to content

Use Locale.ROOT when deriving config property names - #16550

Open
b84330808 wants to merge 2 commits into
apache:3.3from
b84330808:fix/config-property-names-turkish-locale
Open

b84330808 wants to merge 2 commits into
apache:3.3from
b84330808:fix/config-property-names-turkish-locale

Conversation

@b84330808

@b84330808 b84330808 commented Oct 27, 2026 •

Copy link
Copy Markdown

What is the purpose of the change?

Several places turn identifiers and config keys into other forms with toLowerCase()/toUpperCase(), which follow the JVM default locale. Under a Turkish default locale "I".toLowerCase() is a dotless "ı" and "i".toUpperCase() is a dotted "İ", so these keys get mangled. This PR uses Locale.ROOT in all of them, as EnvironmentConfiguration, FixedParamValue and SwitchLogLevel already do:

  • AbstractConfig: property names derived from getters/setters. appendParameters() wrote ıothreads=8 instead of iothreads=8, and refresh() looked up dubbo.protocol.ıothreads, so dubbo.protocol.iothreads was silently ignored.
  • AbstractConfigManager: dubbo.config.mode=override became OVERRİDE, so ConfigMode.valueOf threw and startup failed.
  • ServiceConfig: protocol tri looked up TRİ_DUBBO_PORT_TO_BIND / TRİ_DUBBO_IP_TO_BIND; also the random-port map keys.
  • StringUtils: camelToSplitName, snakeToSplitName, isSnakeCase, toURLKey, toOSStyleKey (dubbo.protocol.iothreads became env var DUBBO_PROTOCOL_İOTHREADS).
  • DubboBeanDefinitionParser: setIothreads() mapped to ıothreads, so the iothreads XML attribute was ignored.
  • Same pattern in ReflectUtils, MethodUtils, PojoUtils, JavaBeanSerializeUtil, ExtensionLoader and EnvironmentAdapter (bean property, setter and extension names).

Regression tests set the default locale to tr-TR (in AbstractConfigTest, ConfigManagerTest, ServiceConfigTest, StringUtilsTest, DubboBeanDefinitionParserTest, ReflectUtilsTest, MethodUtilsTest, PojoUtilsTest, JavaBeanSerializeUtilTest). Each test fails without its source change and passes with it. ExtensionLoader and EnvironmentAdapter have no dedicated test; they are the same one-line change.

I used Claude Code to write this change.

Checklist

  • Make sure there is a GitHub_issue field for the change. (no separate issue; the description above covers it)
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction.
  • Make sure gitHub actions can pass.

AbstractConfig turns getter and setter names into property names with
String.toLowerCase()/toUpperCase(), which follow the JVM default locale.
Under a Turkish default locale "I" lowercases to a dotless "ı", so every
property whose name starts with "i" was mangled:

- appendParameters() wrote "ıothreads=8" instead of "iothreads=8" for
  ProtocolConfig#setIothreads (same for init, injvm, interface, ...).
- refresh() looked up "dubbo.protocol.ıothreads", so
  dubbo.protocol.iothreads from system properties, dubbo.properties or the
  environment was silently ignored.

Use Locale.ROOT in these helpers, as other parts of Dubbo already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.95%. Comparing base (843b98b) to head (b8a2927).
⚠️ Report is 3 commits behind head on 3.3.

Files with missing lines Patch % Lines
...apache/dubbo/common/extension/ExtensionLoader.java 66.66% 0 Missing and 1 partial ⚠️
.../java/org/apache/dubbo/common/utils/PojoUtils.java 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16550      +/-   ##
============================================
+ Coverage     60.90%   60.95%   +0.05%     
- Complexity       15    11754   +11739     
============================================
  Files          1953     1953              
  Lines         89280    89282       +2     
  Branches      13476    13477       +1     
============================================
+ Hits          54376    54422      +46     
+ Misses        29323    29268      -55     
- Partials       5581     5592      +11     
Flag Coverage Δ
integration-tests-java21 32.07% <60.00%> (-0.01%) ⬇️
integration-tests-java8 32.20% <60.00%> (+0.05%) ⬆️
samples-tests-java21 32.10% <57.14%> (-0.03%) ⬇️
samples-tests-java8 29.78% <57.14%> (+<0.01%) ⬆️
unit-tests-java11 59.20% <94.28%> (+0.09%) ⬆️
unit-tests-java17 58.68% <94.28%> (+0.07%) ⬆️
unit-tests-java21 58.68% <94.28%> (+0.05%) ⬆️
unit-tests-java25 58.65% <94.28%> (+0.04%) ⬆️
unit-tests-java8 59.24% <94.28%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@EarthChen EarthChen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug is real: under a Turkish-like default locale (tr, az), "Iothreads".substring(0, 1).toLowerCase() gives "ı", so keys such as iothreads are derived wrongly in appendParameters and refresh. The AbstractConfig changes and tests look correct, but the same root cause remains elsewhere, some of it worse:

  1. AbstractConfigManager (~line 124): configModeStr.toUpperCase() turns strict into STRİCT, and ConfigMode.valueOf throws.
  2. ServiceConfig (~lines 1173/1182/1187): protocol name triple becomes TRİPLE.
  3. StringUtils (~lines 1005/1013/1056/1060): snakeToSplitName, isSnakeCase, toURLKey, toOSStyleKey.
  4. DubboBeanDefinitionParser (~lines 333/398): substring(3, 4).toLowerCase(), the same pattern as this PR.

Please cover these in this PR, or state in the description that the scope is AbstractConfig only and open a follow-up issue. (Line numbers are from a static review on 3.3.)

@b84330808

b84330808 commented Oct 28, 2026 •

Copy link
Copy Markdown
Author

Thanks, good catch! Covered the four spots in b8a2927 (AbstractConfigManager, ServiceConfig, StringUtils, DubboBeanDefinitionParser), each with a tr-TR test. While grepping dubbo-common I also fixed the same getter/setter-name pattern in ReflectUtils, MethodUtils, PojoUtils, JavaBeanSerializeUtil, ExtensionLoader and EnvironmentAdapter.

Left out on purpose: AbortPolicyWithReport lowercases os.name before checking for "win" (Turkish Windows gives wındows), but that's not a key, so I'd keep it separate. There are also ~25 similar calls in other modules (rpc, remoting, registry, plugins). Happy to do a follow-up for those if you'd like.

Per review: the same Turkish-locale problem as in AbstractConfig also
broke config mode parsing (STRİCT), protocol names (TRİPLE), the
StringUtils key helpers and DubboBeanDefinitionParser. Bean property,
setter and extension names in ReflectUtils, MethodUtils, PojoUtils,
JavaBeanSerializeUtil, ExtensionLoader and EnvironmentAdapter are fixed
the same way. Each fixed path has a tr-TR test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@b84330808
b84330808 force-pushed the fix/config-property-names-turkish-locale branch from ae133a7 to b8a2927 Compare October 28, 2026 08:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants