You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/06/22 09:29:27 UTC
[PR] Fix NPE in DefaultLookup.lookupOptional() when container returns null [maven]
gnodet opened a new pull request, #12336:
URL: https://github.com/apache/maven/pull/12336
## Summary
- `PlexusContainer.lookup()` can return `null` instead of throwing `ComponentLookupException`. `DefaultLookup.lookupOptional()` wraps the result with `Optional.of()`, which throws `NullPointerException` on null input. Changed to `Optional.ofNullable()` so a null result is correctly represented as `Optional.empty()`.
- This fixes `maven-jdeprscan-plugin` integration tests (`list-default`, `list-forremoval`) which fail on Maven 4.0.x because `DefaultToolchainManager.retrieveContext()` calls `lookupOptional(Project.class)` and the container returns null.
## Test plan
- [x] Built `maven-jdeprscan-plugin` with this fix and verified all 6 integration tests pass (previously 2 failed with NPE)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
_Claude Code on behalf of Guillaume Nodet_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix NPE in DefaultLookup.lookupOptional() when container returns null [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #12336:
URL: https://github.com/apache/maven/pull/12336
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org