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

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

                Author: ASF GitHub Bot
            Created on: 29/May/23 13:37
            Start Date: 29/May/23 13:37
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #691:
URL: https://github.com/apache/struts/pull/691

   Closes [WW-5261](https://issues.apache.org/jira/browse/WW-5261)




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

            Worklog Id:     (was: 862622)
    Remaining Estimate: 0h
            Time Spent: 10m

> Refactor TagUtils#getStack()
> ----------------------------
>
>                 Key: WW-5261
>                 URL: https://issues.apache.org/jira/browse/WW-5261
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core, Core Tags
>            Reporter: Lukasz Lenart
>            Priority: Major
>             Fix For: 6.2.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Such code
> {code:java}
> if (stack == null) {
>             HttpServletResponse res = (HttpServletResponse) 
> pageContext.getResponse();
>             Dispatcher du = Dispatcher.getInstance();
>             if (du == null) {
>                 throw new ConfigurationException("The Struts dispatcher 
> cannot be found.  This is usually caused by "+
>                         "using Struts tags without the associated filter. 
> Struts tags are only usable when the request "+
>                         "has passed through its servlet filter, which 
> initializes the Struts dispatcher needed for this tag.");
>             }
>             stack = 
> du.getContainer().getInstance(ValueStackFactory.class).createValueStack();
>             HttpParameters params = 
> HttpParameters.create(req.getParameterMap()).build();
>             Map<String, Object> extraContext = du.createContextMap(new 
> RequestMap(req),
>                     params,
>                     new SessionMap<>(req),
>                     new ApplicationMap(pageContext.getServletContext()),
>                     req,
>                     res);
>             extraContext.put(ServletActionContext.PAGE_CONTEXT, pageContext);
>             stack.getContext().putAll(extraContext);
>             req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, 
> stack);
>             // also tie this stack/context to the ThreadLocal
>             ActionContext.of(stack.getContext()).bind();
>         }
> {code}
> should be replaced with an exception, if {{stack}} is null, it means tag was 
> used out of action scope.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to