Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
6.3.0
-
None
Description
Exception if locale contains trimable characters:
Eg Request:
request_locale=de%0A
Code from I18nInterceptor line 187:
if (localeProvider.isValidLocaleString(localeStr)) {
locale = LocaleUtils.toLocale(localeStr);
}
isValidLocaleString returns true because localeStr is trimmed inside function (
locale = LocaleUtils.toLocale(StringUtils.trimToNull(localeStr)) )
but LocaleUtils.toLocale(localeStr) will throw an exception afterwards.
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]
Attachments
Issue Links
- links to