Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C1656200BF6 for ; Tue, 10 Jan 2017 19:06:38 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C009A160B3D; Tue, 10 Jan 2017 18:06:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 15FA9160B2C for ; Tue, 10 Jan 2017 19:06:37 +0100 (CET) Received: (qmail 35909 invoked by uid 500); 10 Jan 2017 18:06:37 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 35900 invoked by uid 99); 10 Jan 2017 18:06:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2017 18:06:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E7B1BDFA0E; Tue, 10 Jan 2017 18:06:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lukaszlenart@apache.org To: commits@struts.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: struts git commit: WW-4722 Uses proper read method Date: Tue, 10 Jan 2017 18:06:36 +0000 (UTC) archived-at: Tue, 10 Jan 2017 18:06:38 -0000 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 Authored: Tue Jan 10 19:06:15 2017 +0100 Committer: Lukasz Lenart 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) {