[ 
https://issues.apache.org/jira/browse/WW-4789?focusedWorklogId=427984&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-427984
 ]

ASF GitHub Bot logged work on WW-4789:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Apr/20 06:04
            Start Date: 28/Apr/20 06:04
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart commented on a change in pull request #397:
URL: https://github.com/apache/struts/pull/397#discussion_r416350023



##########
File path: 
core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
##########
@@ -271,18 +271,18 @@ protected void after(ActionInvocation invocation, String 
result) throws Exceptio
 
     protected void before(ActionInvocation invocation) throws Exception {
         invocation.addPreResultListener(this);
-        Map ses = ActionContext.getContext().getSession();
-        if (ses == null && autoCreateSession) {
-            ses = new SessionMap(ServletActionContext.getRequest());
-            ActionContext.getContext().setSession(ses);
+        Map<String, Object> session = ActionContext.getContext().getSession();
+        if (session == null && autoCreateSession) {
+            session = new SessionMap<>(ServletActionContext.getRequest());
+            ActionContext.getContext().withSession(session);
         }
 
-        if ( ses != null) {
-            lock(ses, invocation);
+        if ( session != null) {
+            lock(session, invocation);
         }
 
         String key = getKey(invocation);
-        Map app = ActionContext.getContext().getApplication();
+        Map<String, Object> app = ActionContext.getContext().getApplication();

Review comment:
       👍 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 427984)
    Time Spent: 50m  (was: 40m)

> ActionContext should be immutable
> ---------------------------------
>
>                 Key: WW-4789
>                 URL: https://issues.apache.org/jira/browse/WW-4789
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 2.6
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Right now ActionContext is a bag of different contexts with mixed 
> responsibility. Also some of them lay in ThreadLocal variable, but some are 
> accessed directly. Also it is easily to modify the internal state which 
> shouldn't be possible. The context should be constant during whole action 
> execution period.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to