Don't throw an exception in CookieLocaleResolver, fallback to default locale instead #22861
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Affects: Spring Framework 5.1.2
In the
CookieLocaleResolver
, would it be possible to ignore the parsing error altogether instead of throwing anIllegalStateException
? Basically, I would want theCookieLocaleResolver
to return the locale from the cookie, if valid, or the default locale otherwise - never throwing an exception.It's easy enough to write a custom
CookieLocaleResolver
, but this seems like a bug to me. When a user has an invalid locale cookie it should not break anything, just fallback to the default locale.This is similar to #19748 where the exception was swallowed for when it's an error dispatch.
The text was updated successfully, but these errors were encountered: