lukaszlenart opened a new pull request, #1590: URL: https://github.com/apache/struts/pull/1590
## Summary - Backport of #1579 from Struts 7.x to Struts 6.x - 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` block so it runs for all annotated methods regardless of `execute()` annotation status. Added `shouldMapDefaultExecuteMethod()` helper method. **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 - [ ] `testDuplicateActionNameWithAnnotatedExecute` passes (new — validates the fix) - [ ] `testDuplicateActionNameWithoutAnnotatedExecute` passes (regression guard) - [ ] All convention plugin tests pass with no regressions 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
