You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@struts.apache.org by "lukaszlenart (via GitHub)" <gi...@apache.org> on 2026/09/13 09:29:50 UTC
[PR] WW-5670 Parse struts.locale once and stop mislabelling the fallback locale [struts]
lukaszlenart opened a new pull request, #1928:
URL: https://github.com/apache/struts/pull/1928
Fixes [WW-5670](https://issues.apache.org/jira/browse/WW-5670)
## Problem
When `struts.locale` is unparseable, `Dispatcher.getLocale` logged `defaulting to request locale [X]`. Since WW-5668, `resolveRequestLocale` may reject the request locale (`struts.locale.validateRequestLocale=true` + a locale not in the JVM's available set) and return the JVM default instead, so the message attributed a runtime default to the client — the opposite of what an operator should conclude. The same path also re-parsed the already-known-unparseable value on every request.
## Change
- `setDefaultLocale` parses `struts.locale` once into `parsedDefaultLocale` and warns once (with the parse exception) when it cannot. Reload/re-injection re-runs the setter, so `dispatcherReinjectedAfterReload` still covers the swap.
- `getLocale` and `resolveRequestLocale` read the parsed value; no `LocaleUtils.toLocale` call remains on the request path. The protected `resolveRequestLocale(HttpServletRequest)` keeps its 7.3.0 signature and semantics, and the bad-`struts.locale` path still goes through it, so subclass overrides are honoured.
- The per-request WARN now reads `defaulting to resolved locale [X]`, which is correct whether or not `validateRequestLocale` is enabled.
No change to which locale is resolved in any combination of unset/parseable/unparseable `struts.locale`, validation on/off, or a throwing `request.getLocale()`.
## Tests
- `testGetLocale_With_BadDefaultLocale_WarnsWithResolvedLocaleNotRequestLocale` — captures the `Dispatcher` WARN through an inline log4j2 appender and asserts the new wording; it reproduced the old misleading message before the fix.
- `testGetLocale_With_BadDefaultLocale_ValidateOn_UnavailableRequestLocale` — pins the previously uncovered resolution path (JVM default) to guard the "diagnostics only" acceptance criterion.
7.x only, per the ticket.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] WW-5670 Parse struts.locale once and stop mislabelling the fallback locale [struts]
Posted by "lukaszlenart (via GitHub)" <gi...@apache.org>.
lukaszlenart merged PR #1928:
URL: https://github.com/apache/struts/pull/1928
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] WW-5670 Parse struts.locale once and stop mislabelling the fallback locale [struts]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #1928:
URL: https://github.com/apache/struts/pull/1928#issuecomment-5652478838
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1928) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1928&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1928&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=1928&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [88.9% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1928&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1928&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1928)
--
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: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org