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
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