struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Egidijus Vaisnora (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4237) Locale is not fetched correctly if array of locales is passed
Date Wed, 30 Oct 2013 16:43:28 GMT

    [ https://issues.apache.org/jira/browse/WW-4237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13809311#comment-13809311
] 

Egidijus Vaisnora commented on WW-4237:
---------------------------------------

I propose something like this (instead of confition ((Object[]) requestedLocale).length ==
1):
{code}
private Object findLocaleParameter(Map<String, Object> params, String parameterName)
{
        Object requestedLocale = params.remove(parameterName);
        if (requestedLocale != null && requestedLocale.getClass().isArray()
                && ((Object[]) requestedLocale).length > 0) {
            requestedLocale = ((Object[]) requestedLocale)[0];

            if (LOG.isDebugEnabled()) {
                LOG.debug("requested_locale=#0", requestedLocale);
            }
        }
        return requestedLocale;
    }
{code}

> Locale is not fetched correctly if array of locales is passed
> -------------------------------------------------------------
>
>                 Key: WW-4237
>                 URL: https://issues.apache.org/jira/browse/WW-4237
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.3.15.1
>            Reporter: Egidijus Vaisnora
>
> If there is passed several parameters "request_only_locale", then I18nInterceptor creates
and sets locale which is equals Array.toString.
> I18nInterceptor.findLocaleParameter checks for array but also checks that array should
be of the length == 1. If it is more than one, then no value is fetched but whole array.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message