lukaszlenart opened a new pull request, #1468:
URL: https://github.com/apache/struts/pull/1468

   ## Summary
   
   Fixes [WW-5594](https://issues.apache.org/jira/browse/WW-5594) - Convention 
plugin exclusion pattern `org.apache.struts2.*` was not properly excluding 
classes directly in the root package.
   
   ### Problem
   
   The exclusion pattern `org.apache.struts2.*` was not excluding classes like 
`XWorkTestCase` directly in the `org.apache.struts2` package because:
   
   1. `PackageBasedActionConfigBuilder` extracts package names using 
`substringBeforeLast(className, ".")` which produces `org.apache.struts2` (no 
trailing dot)
   2. The wildcard pattern requires a literal `.` before `*`
   3. Result: Pattern doesn't match root package classes, triggering WW-5593 
(NoClassDefFoundError)
   
   ### Solution
   
   Enhanced `checkExcludePackages()` to automatically handle patterns ending 
with `.*` by also checking if the package name equals the base pattern (without 
`.*`).
   
   Now `org.apache.struts2.*` properly excludes both:
   - Classes in root package: `org.apache.struts2.XWorkTestCase`
   - Classes in subpackages: `org.apache.struts2.dispatcher.SomeClass`
   
   ### Benefits
   
   - ✅ No configuration duplication needed
   - ✅ Backward compatible - existing configurations with `.*` patterns now 
work correctly
   - ✅ Users don't need to update their configurations
   - ✅ Minimal code change with maximum benefit
   
   ## Test plan
   
   - [x] Added 
`WildcardHelperTest.testWW5594_WildcardPatternRequiresTrailingDot()` - 
documents WildcardHelper behavior
   - [x] Added 
`WildcardHelperTest.testWW5594_ExactPackagePatternMatchesPackageName()` - 
documents exact pattern matching
   - [x] Added 
`PackageBasedActionConfigBuilderTest.testWW5594_RootPackageExclusion()` - 
verifies the fix
   - [x] All existing tests pass
   
   🤖 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]

Reply via email to