[ https://issues.apache.org/jira/browse/WW-5422?focusedWorklogId=918998&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-918998 ]
ASF GitHub Bot logged work on WW-5422: -------------------------------------- Author: ASF GitHub Bot Created on: 13/May/24 05:28 Start Date: 13/May/24 05:28 Worklog Time Spent: 10m Work Description: sonarcloud[bot] commented on PR #931: URL: https://github.com/apache/struts/pull/931#issuecomment-2106684078 ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=931) **Quality Gate passed** Issues ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [8 New issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=931&resolved=false&sinceLeakPeriod=true) ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=931&metric=new_accepted_issues&view=list) Measures ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=931&resolved=false&sinceLeakPeriod=true) ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [84.6% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=931&metric=new_coverage&view=list) ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1.8% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=931&metric=new_duplicated_lines_density&view=list) [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=931) Issue Time Tracking ------------------- Worklog Id: (was: 918998) Time Spent: 50m (was: 40m) > I18nInterceptor and invalid locale > ---------------------------------- > > Key: WW-5422 > URL: https://issues.apache.org/jira/browse/WW-5422 > Project: Struts 2 > Issue Type: Bug > Components: Core Interceptors > Affects Versions: 6.3.0 > Reporter: Andreas Sachs > Assignee: Lukasz Lenart > Priority: Minor > Fix For: 6.5.0 > > Time Spent: 50m > Remaining Estimate: 0h > > Exception if locale contains trimable characters: > > Eg Request: > request_locale=de%0A > > Code from I18nInterceptor line 187: > > {code:java} > if (localeProvider.isValidLocaleString(localeStr)) { > locale = LocaleUtils.toLocale(localeStr); > }{code} > > isValidLocaleString returns true because localeStr is trimmed inside function > ( > locale = LocaleUtils.toLocale(StringUtils.trimToNull(localeStr)) ) > > but LocaleUtils.toLocale(localeStr) will throw an exception afterwards. > > > > {code:java} > > java.lang.IllegalArgumentException: Invalid locale format: de > at > org.apache.commons.lang3.LocaleUtils.parseLocale(LocaleUtils.java:268) > ~[org.apache.commons-commons-lang3-3.12.0-.jar:3.12.0] > at > org.apache.commons.lang3.LocaleUtils.toLocale(LocaleUtils.java:348) > ~[org.apache.commons-commons-lang3-3.12.0-.jar:3.12.0] > at > org.apache.struts2.interceptor.I18nInterceptor.getLocaleFromParam(I18nInterceptor.java:188) > ~[org.apache.struts-struts2-core-6.3.0.2-.jar:6.3.0.2] > at > org.apache.struts2.interceptor.I18nInterceptor$SessionLocaleHandler.find(I18nInterceptor.java:321) > ~[org.apache.struts-struts2-core-6.3.0.2-.jar:6.3.0.2] > {code} > -- This message was sent by Atlassian Jira (v8.20.10#820010)