apache / apache/maven-toolchains-plugin
NPE in ToolchainsRequirement.getParams() when type is not found
- Dominant language
- Java
- Stars
- 27
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
throws when called with a type that is not present in the toolchains map, instead of returning an empty map or null gracefully.
## Location
https://github.com/apache/maven-toolchains-plugin/blob/master/src/main/java/org/apache/maven/plugins/toolchain/ToolchainsRequirement.java#L42-L44
## Code
## Problem
If is not a key in the map, returns , and throws .
Currently this is only called from with types from , which in turn originates from the entry set keys, so the current callers are safe. However, this is a fragile public API that will break if called with an unknown type.
## Impact
Any future or external caller passing a non-existent type will get an unexpected NPE instead of a gracefully handled missing key.
## Suggested Fix
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/main/java/org/apache/maven/plugins/toolchain/ToolchainsRequirement.java at getParams(), especially lines 42-44, and inspect the caller context described in the issue. Verify behavior when the requested type is absent from the toolchains map, then add coverage for that case. Done means an unknown type no longer causes an unexpected NullPointerException and the chosen empty-map-or-null behavior is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100