Skip to content

fix: handle missing toolchain requirement types - #197

Merged
slawekjaranowski merged 1 commit into
apache:masterfrom
efegokdemir:codex/issue-169-toolchains-missing-type
Oct 17, 2026
Merged

slawekjaranowski merged 1 commit into
apache:masterfrom
efegokdemir:codex/issue-169-toolchains-missing-type

Conversation

@efegokdemir

Copy link
Copy Markdown
Contributor

Fixes #169

Summary

ToolchainsRequirement.getParams now handles unknown toolchain types without throwing a NullPointerException.

Changes

  • Return an immutable empty map when the requested type is not configured.
  • Preserve the existing immutable view for configured parameters.
  • Add regression coverage for both unknown and configured types.

Testing

  • JAVA_HOME=/opt/homebrew/Cellar/openjdk/27/libexec/openjdk.jdk/Contents/Home mvn -DskipITs -Dspotless.check.skip=true -Dspotless.apply.skip=true verify — passed; 3 tests passed.
  • git diff --check — passed.
  • Checkstyle, compilation, RAT and dependency analysis passed.
  • Integration tests were not run because -DskipITs was used for local validation.

Notes

This keeps the public method total for unknown keys and avoids changing behavior for configured types. AI assistance was used in preparing this change; I reviewed the modified code and test results.

  • I hereby declare this contribution to be licensed under the Apache License Version 2.0, January 2004.

Signed-off-by: Efe Gökdemir <efe@rexcode.co.uk>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused fix addresses the reported failure, preserves configured-type behavior, and has no identified blocking issues.

No open issues 🎉

What changed in this PR

Fixes #169 by making ToolchainsRequirement.getParams return an immutable empty map for unknown toolchain types instead of throwing a NullPointerException.

Changes:

  • Preserves the existing unmodifiable view for configured parameters.
  • Adds regression tests for unknown and configured types.
File Description
src/​test/​java/​org/​apache/​maven/​plugins/​toolchain/​ToolchainsRequirementTest.java Tests unknown and configured type lookups.
src/​main/​java/​org/​apache/​maven/​plugins/​toolchain/​ToolchainsRequirement.java Handles missing parameters with an immutable empty map.

Review effort: Balanced

@slawekjaranowski
slawekjaranowski merged commit 155d146 into apache:master Oct 17, 2026
17 checks passed
@github-actions github-actions Bot added this to the 3.3.1 milestone Oct 17, 2026
@github-actions

Copy link
Copy Markdown

@slawekjaranowski Please assign appropriate label to PR according to the type of change.

@slawekjaranowski slawekjaranowski added the bug Something isn't working label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPE in ToolchainsRequirement.getParams() when type is not found

4 participants