Repository navigation
[java] Fix #7137: InvalidLogMessageFormat: handle unresolved exception type (incomplete auxclasspath) - #7160
Conversation
|
@UncleOwen, please review the changes :) |
|
Compared to main: (comment created at 2026-10-26 15:13:10+00:00 for b44c8f3) |
|
The unit test added here confirms that the issue exists if the auxiliary classpath is not configured correctly and PMD cannot see the type hierarchy of the custom exception. The fix makes the code more robust in case the type information is missing. I'd suggest to update the PR description and the test description to reflect that. |
adangel
left a comment
There was a problem hiding this comment.
Thanks, looks good.
I think, this makes a reasonable improvement for the case, that PMD is called wrongly (without the correct auxclasspath). The catch parameter must be of type throwable, so this assumption is pretty safe.
Describe the PR
This PR fixes issue #7137.
It wasn't much of a change, I had just introduced a new branch in the InvalidLogMessageRule.java (isThrowable method) that checks if the catch parameter is a throwable subtype. Even if the type is unresolveable.
The made the test code pass. I added it in the InvalidLogMessageFormat.xml file.
Related issues
Closes #7137
Ready?
Yes, according to me
./mvnw clean verifypasses (checked automatically by github actions)