[
https://issues.apache.org/jira/browse/WW-5422?focusedWorklogId=918997&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-918997
]
ASF GitHub Bot logged work on WW-5422:
--------------------------------------
Author: ASF GitHub Bot
Created on: 13/May/24 05:17
Start Date: 13/May/24 05:17
Worklog Time Spent: 10m
Work Description: sonarcloud[bot] commented on PR #931:
URL: https://github.com/apache/struts/pull/931#issuecomment-2106673873
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=931)
**Quality Gate failed**
Failed conditions
 [73.1% Coverage on New
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=931&metric=new_coverage&view=list)
(required ≥ 80%)
[See analysis details on
SonarCloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=931)
Issue Time Tracking
-------------------
Worklog Id: (was: 918997)
Time Spent: 40m (was: 0.5h)
> 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: 40m
> 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)