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

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

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

   ## Summary
   
   - Fix duplicate `@Action` name detection being skipped when `execute()` is 
annotated with `@Action`
   - Extract the duplicate check loop to run unconditionally before the 
conditional block in `PackageBasedActionConfigBuilder.buildConfiguration()`
   - Add test fixtures and unit tests for both the previously-broken and 
already-working scenarios
   
   Fixes [WW-4421](https://issues.apache.org/jira/browse/WW-4421)
   
   ## Problem
   
   The duplicate `@Action` name detection in 
`PackageBasedActionConfigBuilder.buildConfiguration()` was embedded inside a 
conditional block (`!map.containsKey(DEFAULT_METHOD)`) whose primary purpose is 
deciding whether to auto-create a mapping for `execute()`. When `execute()` is 
annotated with `@Action`, the condition is `false` and the entire duplicate 
detection is skipped — silently allowing two methods to map to the same action 
name, with one overwriting the other non-deterministically.
   
   ## Changes
   
   **`PackageBasedActionConfigBuilder.java`** — Moved the `actionNames` 
duplicate check loop before the `if (!map.containsKey(DEFAULT_METHOD) ...)` 
block so it runs for all annotated methods regardless of `execute()` annotation 
status.
   
   **Test fixtures:**
   - `DuplicateActionNameWithExecuteAnnotationAction` — `@Action("duplicate")` 
on both `execute()` and another method (the previously undetected case)
   - `DuplicateActionNameWithoutExecuteAnnotationAction` — unannotated 
`execute()` with two methods sharing `@Action("duplicate")` (regression guard)
   
   **`PackageBasedActionConfigBuilderTest.java`** — Two new test methods 
verifying `ConfigurationException` is thrown in both scenarios.
   
   ## Test plan
   
   - [x] `testDuplicateActionNameWithAnnotatedExecute` passes (new — validates 
the fix)
   - [x] `testDuplicateActionNameWithoutAnnotatedExecute` passes (regression 
guard)
   - [x] All 117 convention plugin tests pass with no regressions
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)




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

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

> Duplicate @Action value annotation check skipped
> ------------------------------------------------
>
>                 Key: WW-4421
>                 URL: https://issues.apache.org/jira/browse/WW-4421
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Annotations, Plugin - Convention
>    Affects Versions: 2.3.16.3
>            Reporter: Sebastian Haas
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 6.9.0, 7.2.0
>
>         Attachments: MethodCheckFailsOnStartup.java, 
> MethodCheckSkippedOnStartup.java
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{PackageBasedActionConfigBuilder#buildConfiguration}} checks if there are 
> duplicate action names on method annotations. If {{ActionSupport#execute}} is 
> overridden and annotated with {{@Action}}, the duplicate action name check is 
> skipped.
> The check is disabled due to 
> {code:title=PackageBasedActionConfigBuilder.java:674}if 
> (!map.containsKey(DEFAULT_METHOD){code}
> Having duplicate action names leads to different behavior with Java 7 or Java 
> 8 environment (due to reflection method order).



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

Reply via email to