ascheman opened a new pull request, #12385:
URL: https://github.com/apache/maven/pull/12385

   ### What
   Adds `DefaultLookupTest` (maven-core) — the regression test that the 
backported NPE fix #12340 shipped without.
   
   ### Why
   #12340 (backport of #12336) changed `DefaultLookup.lookupOptional(...)` to 
use `Optional.ofNullable` instead of `Optional.of`, so a `null` component 
lookup returns an empty `Optional` instead of throwing `NullPointerException`. 
Nothing currently guards that behavior on this line — reverting the fix goes 
undetected by the suite.
   
   ### Test
   `DefaultLookupTest` covers both `lookupOptional` overloads:
   - container returns `null` -> empty `Optional` (the guarded NPE case)
   - container returns a value -> present `Optional`
   - `ComponentLookupException` whose cause is `NoSuchElementException` -> empty
   
   Verified locally: green on current maven-4.0.x; reverting `ofNullable`->`of` 
turns the two null-case tests red with the NPE from `java.util.Optional.of`. No 
production code change.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to