Skip to content

[java] Fix #6782: Add missing check for varargs - #6783

Merged
adangel merged 3 commits into
pmd:mainfrom
UncleOwen:issue-UseStandardCharsets-ArrayIndexOutOfBoundsException-in-rule-UseStandardCharsetsRule.java
Jun 18, 2026
Merged

adangel merged 3 commits into
pmd:mainfrom
UncleOwen:issue-UseStandardCharsets-ArrayIndexOutOfBoundsException-in-rule-UseStandardCharsetsRule.java

Conversation

@UncleOwen

Copy link
Copy Markdown
Member

Describe the PR

The current code doesn't account for varargs when looking for methods with an almost-same signature. This PR fixes this.

Related issues

Ready?

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

@pmd-actions-helper

pmd-actions-helper Bot commented Jun 16, 2026 •

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, 15 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-06-16 15:32:30+00:00 for 60c6d4f)

If we're looking at a varargs call, the index can be out-of-bounds for
the formal parameters.
@UncleOwen
UncleOwen force-pushed the issue-UseStandardCharsets-ArrayIndexOutOfBoundsException-in-rule-UseStandardCharsetsRule.java branch from d9d5964 to 60c6d4f Compare June 16, 2026 15:16
uhafner added a commit to jenkinsci/plugin-util-api-plugin that referenced this pull request Jun 17, 2026
@adangel adangel added this to the 7.26.0 milestone Jun 18, 2026

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@adangel
adangel merged commit 13ac972 into pmd:main Jun 18, 2026
13 checks passed
@UncleOwen
UncleOwen deleted the issue-UseStandardCharsets-ArrayIndexOutOfBoundsException-in-rule-UseStandardCharsetsRule.java branch June 18, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java] UseStandardCharsets: ArrayIndexOutOfBoundsException in line 81

2 participants