Repository: struts Updated Branches: refs/heads/master 484ce1d19 -> baffa9a68
WW-4722 Checks proper scope for stored locale Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/baffa9a6 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/baffa9a6 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/baffa9a6 Branch: refs/heads/master Commit: baffa9a68b2ff02cab3387ab0b53794a1e541c7e Parents: 484ce1d Author: Lukasz Lenart <lukaszlen...@apache.org> Authored: Fri Dec 2 19:30:36 2016 +0100 Committer: Lukasz Lenart <lukaszlen...@apache.org> Committed: Fri Dec 2 19:30:36 2016 +0100 ---------------------------------------------------------------------- .../struts2/interceptor/I18nInterceptor.java | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/baffa9a6/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java index 16ce51f..4d3bdf0 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java @@ -235,16 +235,21 @@ public class I18nInterceptor extends AbstractInterceptor { * @return the read locale */ protected Locale readStoredLocale(ActionInvocation invocation) { - Locale locale = readStoredLocalFromSession(invocation); - if (locale != null) { - LOG.debug("Found stored Locale {} in session, using it!", locale); - return locale; + Locale locale; + if (storage == Storage.COOKIE) { + locale = readStoredLocalFromSession(invocation); + if (locale != null) { + LOG.debug("Found stored Locale {} in session, using it!", locale); + return locale; + } } - Locale cookie = readStoredLocaleFromCookie(invocation); - if (cookie != null) { - LOG.debug("Found stored Locale {} in cookies, using it!", locale); - return cookie; + if (storage == Storage.SESSION) { + locale = readStoredLocaleFromCookie(invocation); + if (locale != null) { + LOG.debug("Found stored Locale {} in cookies, using it!", locale); + return locale; + } } LOG.debug("Neither locale was in session nor in cookies, searching current Invocation context");