[
https://issues.apache.org/jira/browse/WW-5646?focusedWorklogId=1029583&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1029583
]
ASF GitHub Bot logged work on WW-5646:
--------------------------------------
Author: ASF GitHub Bot
Created on: 12/Jul/26 12:39
Start Date: 12/Jul/26 12:39
Worklog Time Spent: 10m
Work Description: arunmanni-ai commented on PR #1780:
URL: https://github.com/apache/struts/pull/1780#issuecomment-4951206848
Fixed a regression introduced by the Stack → ArrayDeque swap: the rebuild
loop iterated the deque head-to-tail (most recently pushed first), which is the
reverse of Stack's insertion-order iteration. This caused rebuilt paths like
`car/view.jsp` to come out as `view.jsp/car`, which is what the CI failures
were catching.
Fixed by using `descendingIterator()` to restore the original oldest-first
ordering when rebuilding the flat path string. The traversal-prevention logic
(tokenizing, `..` → pop, the `isEmpty()` guard clamping excess `..` at root) is
unchanged.
Verified locally — all passed.
Issue Time Tracking
-------------------
Worklog Id: (was: 1029583)
Remaining Estimate: 0h
Time Spent: 10m
> Modernize path normalization in Include component
> -------------------------------------------------
>
> Key: WW-5646
> URL: https://issues.apache.org/jira/browse/WW-5646
> Project: Struts 2
> Issue Type: Improvement
> Components: Core
> Affects Versions: 7.2.1
> Reporter: Arun Manni
> Priority: Minor
> Fix For: 7.3.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Include.getContextRelativePath() uses java.util.Stack for path
> normalization. Stack is a legacy class (extends synchronized Vector)
> and is unnecessary for a local variable. The method also does not
> handle the edge case where dot-dot segments exceed the available
> path depth, which can cause an EmptyStackException.
> This patch replaces Stack with ArrayDeque, adds an isEmpty() guard
> before pop(), and modernizes the iteration to use an enhanced
> for-loop. Test coverage added for edge case paths.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)