[
https://issues.apache.org/jira/browse/WW-5668?focusedWorklogId=1033021&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1033021
]
ASF GitHub Bot logged work on WW-5668:
--------------------------------------
Author: ASF GitHub Bot
Created on: 30/Jul/26 11:28
Start Date: 30/Jul/26 11:28
Worklog Time Spent: 10m
Work Description: sonarqubecloud[bot] commented on PR #1821:
URL: https://github.com/apache/struts/pull/1821#issuecomment-5130264552
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1821)
**Quality Gate passed**
Issues
 [3 New
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1821&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1821&issueStatuses=ACCEPTED)
Measures
 [0 Security
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=1821&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [86.8% Coverage on New
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1821&metric=new_coverage&view=list)
 [0.0% Duplication on New
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1821&metric=new_duplicated_lines_density&view=list)
<!
Issue Time Tracking
-------------------
Worklog Id: (was: 1033021)
Time Spent: 50m (was: 40m)
> Make the localized-text provider caches size-bounded and align request-locale
> resolution across entry points
> ------------------------------------------------------------------------------------------------------------
>
> Key: WW-5668
> URL: https://issues.apache.org/jira/browse/WW-5668
> Project: Struts 2
> Issue Type: Improvement
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 7.3.0
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Two related follow-ups to the localized-text provider work in WW-5540.
> h2. 1. Bounded caches, consistent with the rest of the framework
> {{AbstractLocalizedTextProvider}} keeps several internal caches --
> {{bundlesMap}}, {{messageFormats}}, {{missingBundles}}, and the
> {{classHierarchyCache}} / {{packageHierarchyCache}} added in WW-5540. These
> are plain {{ConcurrentHashMap}}s with no configurable upper bound or eviction
> policy.
> Elsewhere the framework already standardises on bounded, configurable caches:
> the OGNL expression cache ({{struts.ognl.expressionCacheType=wtlfu}},
> {{struts.ognl.expressionCacheMaxSize=10000}}), the BeanInfo cache, and the
> proxy detection cache ({{struts.proxy.cacheMaxSize=10000}}) all support a
> cache type and a maximum size via {{OgnlCacheFactory}} /
> {{DefaultOgnlCacheFactory}}. The localized-text caches are the outlier.
> Bring them in line: give the localized-text caches a configurable maximum
> size and eviction (reusing the existing cache abstraction), with new
> constants following the established naming, e.g. {{struts.i18n.cacheType}}
> and {{struts.i18n.cacheMaxSize}}, defaulting to the same {{wtlfu}} /
> {{10000}} as the OGNL and proxy caches. Normal localized-text behaviour must
> be unchanged for typical applications.
> h2. 2. Consistent request-locale resolution
> Struts resolves a request locale from more than one place, and the two paths
> behave differently:
> * {{I18nInterceptor}} (the {{request_locale}} parameter / cookie / session
> path) resolves the value and then checks it against the available-locale set
> via {{LocaleProvider.isValidLocale(...)}}, falling back to the configured
> default when the resolved locale is not an available one.
> * {{Dispatcher.getLocale(...)}} -- used when {{struts.locale}} is unset --
> returns {{request.getLocale()}} directly, without that availability check.
> Align the two so a request-derived locale is resolved consistently regardless
> of entry point (a shared resolve/validate boundary, applying the same
> available-locale check the interceptor already uses).
> h2. Scope / acceptance
> * Localized-text caches honour a configurable maximum size with eviction;
> defaults match the existing OGNL/proxy cache conventions.
> * Request-locale resolution is consistent across {{Dispatcher}} and
> {{I18nInterceptor}}.
> * Documented in {{default.properties}} alongside the other cache settings.
> * Tests: cache size stays within the configured bound as locale/key diversity
> grows; correct localized text is still returned for normal and repeated
> locales; locale resolution behaviour is covered for both entry points.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)