[
https://issues.apache.org/jira/browse/WW-5261?focusedWorklogId=862630&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-862630
]
ASF GitHub Bot logged work on WW-5261:
--------------------------------------
Author: ASF GitHub Bot
Created on: 29/May/23 14:01
Start Date: 29/May/23 14:01
Worklog Time Spent: 10m
Work Description: sonarcloud[bot] commented on PR #691:
URL: https://github.com/apache/struts/pull/691#issuecomment-1567177313
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=691)
[](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=691&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=691&resolved=false&types=BUG)
[0
Bugs](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=691&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=691&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=691&resolved=false&types=VULNERABILITY)
[0
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=691&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=691&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=691&resolved=false&types=SECURITY_HOTSPOT)
[0 Security
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=691&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=691&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=691&resolved=false&types=CODE_SMELL)
[0 Code
Smells](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=691&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=691&metric=new_coverage&view=list)
[82.4%
Coverage](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=691&metric=new_coverage&view=list)
[](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=691&metric=new_duplicated_lines_density&view=list)
[0.0%
Duplication](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=691&metric=new_duplicated_lines_density&view=list)
Issue Time Tracking
-------------------
Worklog Id: (was: 862630)
Time Spent: 0.5h (was: 20m)
> 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: 0.5h
> 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)