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

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

                Author: ASF GitHub Bot
            Created on: 06/Mar/26 10:23
            Start Date: 06/Mar/26 10:23
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #1614:
URL: https://github.com/apache/struts/pull/1614

   ## Summary
   
   Fixes [WW-2963](https://issues.apache.org/jira/browse/WW-2963)
   
   - `default-action-ref` fallback now resolves via wildcard matching when the 
exact action map lookup fails
   - Mirrors the exact→wildcard resolution pattern already used for request 
action names (3 lines added)
   - Adds three tests covering exact-match default-action-ref, wildcard-match 
default-action-ref, and no-match fallback
   
   ## Root Cause
   
   In 
`DefaultConfiguration.RuntimeConfigurationImpl.findActionConfigInNamespace()`, 
the default-action-ref fallback only did `actions.get(defaultActionRef)` — an 
exact key lookup. If the default ref name (e.g., `"movie-input"`) only matched 
a wildcard pattern (e.g., `"movie-*"`), the lookup returned `null` and the 
request failed with a 404.
   
   ## Fix
   
   After the exact lookup fails for the default action ref, also try the 
wildcard matcher:
   
   ```java
   config = actions.get(defaultActionRef);
   if (config == null) {
       config = 
namespaceActionConfigMatchers.get(namespace).match(defaultActionRef);
   }
   ```
   
   ## Test plan
   
   - [x] `ConfigurationTest#testDefaultActionRefWithWildcard` — 
default-action-ref resolves via wildcard matching
   - [x] `ConfigurationTest#testDefaultActionRefWithExactMatch` — 
default-action-ref resolves via exact match (pre-existing behavior)
   - [x] `ConfigurationTest#testDefaultActionRefWithWildcardNoMatch` — returns 
null when default-action-ref matches neither
   - [x] Full `ConfigurationTest` suite passes with no regressions
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)




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

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

> default-action-ref fails to find wildcard named actions
> -------------------------------------------------------
>
>                 Key: WW-2963
>                 URL: https://issues.apache.org/jira/browse/WW-2963
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.1.6
>         Environment: Windows XP, jetty 6.1.5, Java 1.6
>            Reporter: Tomasz Nurkiewicz
>            Assignee: Lukasz Lenart
>            Priority: Minor
>             Fix For: 6.9.0, 7.2.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> With {{struts.xml}} fragment given below:
> {code:xml}
> <default-action-ref name="movie-list" />
> <action name="movies" class="moviesAction" method="list">
>   <!-- -->
> </action>
> <action name="movie-*" method="{1}" class="moviesAction">
>   <!-- -->
> </action>
> {code}
> Struts2 returns 404: "There is no Action mapped for namespace / and action 
> name ." Specifying action with no wildcard name (e.g. {{<default-action-ref 
> name="movies" />}}) works as expected.



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

Reply via email to