GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] Fix #7137: InvalidLogMessageFormat: handle unresolved exception type (incomplete auxclasspath) by KaustAbhinand · Pull Request #7160 · pmd/pmd

Conversation

@KaustAbhinand

@KaustAbhinand KaustAbhinand commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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

  • Fix [java] InvalidLogMessageFormat: False positive for unresolved exception type (incomplete auxclasspath) #7137
  • Files changed: InvalidLogFormatRule.java - Just a single change - I added a branch that ensures that a Catch parameter is a throwable subtype.
  • InvalidLogMessageFormat.xml - Has the test code to reproduce it.

Ready?

Yes, according to me

  • [ Yes] Added unit tests for fixed bug/feature
  • [ Yes] Passing all unit tests
  • [ Yes] Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@KaustAbhinand
Fix for issue #7137.
ece06b5
@KaustAbhinand

KaustAbhinand commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@UncleOwen, please review the changes :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pmd-actions-helper

pmd-actions-helper Bot commented Oct 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 16 errors and 9 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-10-26 15:13:10+00:00 for b44c8f3)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zbynek

zbynek commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zbynek zbynek changed the title Fix for issue #7137. [java] [java] InvalidLogMessageFormat false positive when if/else block in the catch block Oct 19, 2026
@adangel adangel changed the title [java] InvalidLogMessageFormat false positive when if/else block in the catch block [java] Fix #7137: InvalidLogMessageFormat false positive when if/else block in the catch block Oct 26, 2026
@adangel
Merge branch 'main' into pr-7160
7ea9255
@adangel adangel added the in:type-resolution Affects the type resolution code label Oct 26, 2026
@adangel
Update release notes (#7137), comments
b44c8f3
@adangel adangel added this to the 7.29.0 milestone Oct 26, 2026
adangel
adangel approved these changes Oct 26, 2026
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/InvalidLogMessageFormatRule.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@adangel adangel changed the title [java] Fix #7137: InvalidLogMessageFormat false positive when if/else block in the catch block [java] Fix #7137: InvalidLogMessageFormat: handle unresolved exception type (incomplete auxclasspath) Oct 26, 2026
@adangel
adangel merged commit 817b8cd into pmd:main Oct 26, 2026
13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adangel adangel adangel approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

in:type-resolution Affects the type resolution code

Projects

None yet

Milestone

7.29.0

Development

Successfully merging this pull request may close these issues.

[java] InvalidLogMessageFormat: False positive for unresolved exception type (incomplete auxclasspath)

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@KaustAbhinand @zbynek @adangel
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.