You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Better handling of illegal locale values in LocaleChangeInterceptor [SPR-9456] #14091
java.lang.IllegalArgumentException: Locale value "no-" contains invalid characters
at org.springframework.util.StringUtils.parseLocaleString(StringUtils.java:671)
at org.springframework.web.servlet.i18n.LocaleChangeInterceptor.preHandle(LocaleChangeInterceptor.java:73)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:781)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
at javax.servlet.http.HttpServlet.doHead(HttpServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:117)
Maybe a better solution is to catch this exception in LocaleChangeInterceptor and just write a logmessage.
Is there a way to by pass this issue without extending LocaleChangeInterceptor ?
This issue makes it hard to recover from a simple wrong query parameter.
I've added an "ignoreInvalidLocale" property to LocaleChangeInterceptor, catching such an IllegalArgumentException and logging its message at debug level instead of propagating it.
Activity
spring-projects-issues commentedon Feb 6, 2015
Christian Gendreau commented
Is there a way to by pass this issue without extending LocaleChangeInterceptor ?
This issue makes it hard to recover from a simple wrong query parameter.
Thanks
spring-projects-issues commentedon Apr 17, 2015
Jeff Conrad commented
FYI
http://stackoverflow.com/questions/24786962/define-default-locale-and-treat-exceptions-for-spring-locale-interceptor
mentions a workaround.
spring-projects-issues commentedon Sep 21, 2015
Rossen Stoyanchev commented
Will take a look at this for 4.2.2.
spring-projects-issues commentedon Sep 23, 2015
Juergen Hoeller commented
I've added an "ignoreInvalidLocale" property to
LocaleChangeInterceptor, catching such anIllegalArgumentExceptionand logging its message at debug level instead of propagating it.Juergen