Repository navigation
WW-5792 Warn instead of silently skipping non-public action classes - #2054
Merged
Merged
Conversation
…ion classes verifyAction threw "is not public" inside the try whose RuntimeException handler swallowed it, so a non-public action class only produced a misleading INFO line. It now logs a WARN naming the class and location and skips the constructor check, so startup behaves as before. Failing startup is tracked in WW-5809 for 8.0.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused diagnostic change preserves existing behavior, has targeted regression coverage, and has no unresolved findings.
No open issues 🎉
What changed in this PR
This PR improves XML action configuration diagnostics by warning about non-public action classes while preserving existing startup behavior.
Changes:
- Replaces the swallowed exception with a WARN containing the class name, configuration location, and planned Struts 8.0.0 startup failure.
- Preserves the early exit that skips constructor validation for non-public classes.
- Adds a regression test and fixtures covering warning emission and successful configuration loading.
| File | Description |
|---|---|
| core/src/test/resources/org/apache/struts2/config/providers/xwork-test-action-non-public.xml | Configures the non-public action test fixture. |
| core/src/test/java/org/apache/struts2/config/providers/XmlConfigurationProviderActionsTest.java | Verifies warning emission and configuration loading. |
| core/src/test/java/org/apache/struts2/config/providers/NonPublicAction.java | Provides a package-private action fixture. |
| core/src/main/java/org/apache/struts2/config/providers/XmlDocConfigurationProvider.java | Logs the warning and skips constructor validation. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes WW-5792
Problem
XmlDocConfigurationProvider#verifyActionthrewConfigurationException("... is not public")inside atrywhosecatch (RuntimeException)handler swallowed it. A non-public action class therefore loaded with only a misleading INFO line ("Unable to verify action class ... exists at initialization").Change
getConstructor(), just as the old swallowed throw did. Without that, a package-private class, whose implicit constructor is package-private too, would fail with "does not have a public no-arg constructor". That would break startup for apps that work today, which is what 7.5.0 should not do.ObjectFactorycan still build these actions throughContainerImpl'ssetAccessible(true).Failing startup is deferred to 8.0.0 in WW-5809, which matches the Struts Boot registry provider (WW-5791).
7.5.0 migration notes owe one line: non-public XML action classes now log a warning and will fail startup in 8.0.0.
Testing
XmlConfigurationProviderActionsTest#testNonPublicActionWarnsAndLoadsfailed before the fix (no WARN) and passes after it.coresuite: 3545 tests, 0 failures.🤖 Generated with Claude Code