gnodet opened a new pull request, #13162: URL: https://github.com/apache/maven/pull/13162
Forward-port of hardening applied during review of #13159 (maven-4.0.x backport). ## Changes ### `DefaultNode.java` Replace `Optional.ofNullable(result.getRepository())` with a proper `Optional.ofNullable(result).map(...)` chain. `LocalRepositoryManager.find()` is not annotated `@Nonnull` in the resolver API contract — a third-party LRM implementation returning `null` would NPE on the original code. The standard `SimpleLocalRepositoryManager` always returns a non-null result, so this is a defensive guard for custom implementations. ### `DefaultNodeTest.java` - Both tests that call `lrm.find()` now use `ArgumentCaptor<LocalArtifactRequest>` and assert that the captured request carries the correct artifact and repositories list. Previously `any(LocalArtifactRequest.class)` silently accepted any request. - Add `testGetRepositoryReturnsEmptyWhenLrmReturnsNull` to explicitly cover the null-result path. -- 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]
