Repository: struts Updated Branches: refs/heads/master f48c9620f -> d12bb7cdd
WW-4722 Uses proper read method Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/d12bb7cd Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/d12bb7cd Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/d12bb7cd Branch: refs/heads/master Commit: d12bb7cddbc8f3ebbba64d3df209bb078735e8ea Parents: f48c962 Author: Lukasz Lenart <[email protected]> Authored: Tue Jan 10 19:06:15 2017 +0100 Committer: Lukasz Lenart <[email protected]> Committed: Tue Jan 10 19:06:15 2017 +0100 ---------------------------------------------------------------------- .../apache/struts2/interceptor/I18nInterceptor.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/d12bb7cd/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 da7c6b7..f5a778d 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java @@ -135,7 +135,7 @@ public class I18nInterceptor extends AbstractInterceptor { try { this.storage = Storage.valueOf(storageName.toUpperCase()); } catch (IllegalArgumentException e) { - LOG.warn(new ParameterizedMessage("Wrong storage name [{{}] was defined, falling back to {}", storageName, Storage.SESSION), e); + LOG.warn(new ParameterizedMessage("Wrong storage name [{}] was defined, falling back to {}", storageName, Storage.SESSION), e); this.storage = Storage.SESSION; } } @@ -229,15 +229,15 @@ public class I18nInterceptor extends AbstractInterceptor { } /** - * Reads the locale from the session, and if not found from the - * current invocation (=browser) + * Reads the locale from the session or from a cookie and if not found + * from the current invocation (=browser) * * @param invocation the current invocation * @return the read locale */ protected Locale readStoredLocale(ActionInvocation invocation) { Locale locale; - if (storage == Storage.COOKIE) { + if (storage == Storage.SESSION) { locale = readStoredLocalFromSession(invocation); if (locale != null) { LOG.debug("Found stored Locale {} in session, using it!", locale); @@ -245,16 +245,16 @@ public class I18nInterceptor extends AbstractInterceptor { } } - if (storage == Storage.SESSION) { + if (storage == Storage.COOKIE) { locale = readStoredLocaleFromCookie(invocation); if (locale != null) { - LOG.debug("Found stored Locale {} in cookies, using it!", locale); + LOG.debug("Found stored Locale {} in cookie, using it!", locale); return locale; } } LOG.debug("Neither locale was in session nor in cookies, searching current Invocation context"); - return readStoredLocalFromCurrentInvocation(invocation); + return readStoredLocaleFromCurrentInvocation(invocation); } /** @@ -319,7 +319,7 @@ public class I18nInterceptor extends AbstractInterceptor { return null; } - protected Locale readStoredLocalFromCurrentInvocation(ActionInvocation invocation) { + protected Locale readStoredLocaleFromCurrentInvocation(ActionInvocation invocation) { // no overriding locale definition found, stay with current invocation (=browser) locale Locale locale = invocation.getInvocationContext().getLocale(); if (locale != null) {
