You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "slawekjaranowski (via GitHub)" <gi...@apache.org> on 2023/06/21 08:24:45 UTC
[GitHub] [maven-dependency-plugin] slawekjaranowski commented on a diff in pull request #328: MDEP-875 prevent possible NPE
slawekjaranowski commented on code in PR #328:
URL: https://github.com/apache/maven-dependency-plugin/pull/328#discussion_r1236603544
##########
src/main/java/org/apache/maven/plugins/dependency/ListRepositoriesMojo.java:
##########
@@ -104,8 +104,10 @@ public boolean visitLeave(DependencyNode node) {
.collect(Collectors.groupingBy(
repo -> repo.getMirroredRepositories().isEmpty()));
- prepareRemoteRepositoriesList(message, repoGroupByMirrors.get(Boolean.TRUE));
- prepareRemoteMirrorRepositoriesList(message, repoGroupByMirrors.get(Boolean.FALSE));
+ prepareRemoteRepositoriesList(
+ message, repoGroupByMirrors.getOrDefault(Boolean.TRUE, Collections.emptyList()));
+ prepareRemoteMirrorRepositoriesList(
+ message, repoGroupByMirrors.getOrDefault(Boolean.FALSE, Collections.emptyList()));
Review Comment:
We can also check in methods `prepareRemote*` if list is empty to avoid produce incomplete message.
--
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