struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (WW-3534) PrepareOperations.createActionContext does not detect existing context correctly
Date Sun, 23 Apr 2017 09:28:04 GMT

     [ https://issues.apache.org/jira/browse/WW-3534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lukasz Lenart updated WW-3534:
------------------------------
    Fix Version/s:     (was: 3.0)
                   2.6

> PrepareOperations.createActionContext does not detect existing context correctly
> --------------------------------------------------------------------------------
>
>                 Key: WW-3534
>                 URL: https://issues.apache.org/jira/browse/WW-3534
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.6
>            Reporter: Jim Culbert
>             Fix For: 2.6
>
>
> ****The Problem****
> In revision 768529 (current head revision) of /struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java
at lines 72-73, there is a logic error. 
> ActionContext.getContext will never return null, it always returns a context object (when
no context has been created in the thread, action ActionContext.getContext() casts an empty
map to an ActionContext object when it returns, so, even thoughg no initialization has been
done, the getContext method still returns a non-null object that contains an empty context
map).
> The implication of this is that, when the StrutsPrepareAndExecuteFilter (and presumably
the StrutsPrepareFilter) runs, execution never follows the code branch which is designed to
initialize the value stack.
> I think the reason this does not cause more problems is that there seems to be defensive
code in a lot of places that initializes the valuestack/actioncontext if things don't "look
right". 
> ****Where I saw the problem****
> In my use case, I initialize the locale in the action context (scriptlet in the view
jsp...)  prior to using any <s:text> tag. When I do use a tag, the text helper code
detects that there is no value stack and creates a new actioncontext (thus blowing away the
locale setting that I had established). The result is that regardless of what I set the locale
to, the tags always rendered in the default locale. Hack was to use any tag that manipulates
the value stack before setting the locale but, this obviously needs to be fixed...



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message