[ 
https://issues.apache.org/jira/browse/WW-5668?focusedWorklogId=1033014&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1033014
 ]

ASF GitHub Bot logged work on WW-5668:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Jul/26 11:06
            Start Date: 30/Jul/26 11:06
    Worklog Time Spent: 10m 
      Work Description: sonarqubecloud[bot] commented on PR #1821:
URL: https://github.com/apache/struts/pull/1821#issuecomment-5130025979

   ## [![Quality Gate 
Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png
 'Quality Gate 
Failed')](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1821) 
**Quality Gate failed**  
   Failed conditions  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png
 '') [B Reliability Rating on New 
Code](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1821) 
(required ≥ A)  
     
   <!

Issue Time Tracking
-------------------

    Worklog Id:     (was: 1033014)
    Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  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)

Reply via email to