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

   ## Summary
   
   Fixes [WW-5593](https://issues.apache.org/jira/browse/WW-5593)
   
   - Add `NoClassDefFoundError` to the catch block in 
`PackageBasedActionConfigBuilder.getActionClassTest()`
   - Improve error message to help users understand missing dependency issues
   - Add unit tests for both `NoClassDefFoundError` and 
`ClassNotFoundException` handling
   
   ## Problem
   
   The convention plugin's `PackageBasedActionConfigBuilder` only caught 
`ClassNotFoundException` but not `NoClassDefFoundError` when scanning for 
action classes. This caused complete application startup failure when:
   
   - `struts.convention.action.includeJars` is configured
   - Scanned JARs contain classes with missing optional dependencies (e.g., 
test classes depending on JUnit)
   
   ## Solution
   
   Use multi-catch to handle both exception types:
   ```java
   } catch (ClassNotFoundException | NoClassDefFoundError ex) {
       LOG.error("Unable to load class [{}]. Perhaps it exists but certain 
dependencies are not available?",
               classInfo.getName(), ex);
       return false;
   }
   ```
   
   ## Test plan
   
   - [x] New unit test `testNoClassDefFoundErrorHandling()` verifies 
`NoClassDefFoundError` is caught
   - [x] New unit test `testClassNotFoundExceptionHandling()` verifies existing 
behavior preserved
   - [x] All 8 tests in `PackageBasedActionConfigBuilderTest` 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