Skip to content

Commit

Permalink
MDEP-875 prevent possible NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
rosti-il authored and slawekjaranowski committed Jun 24, 2023
1 parent 9e479d4 commit 3c877fb
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,21 @@ public boolean visitLeave(DependencyNode node) {
}
}));

if (repositories.isEmpty()) {
getLog().info("No remote repository is used by this build." + System.lineSeparator());
return;
}

StringBuilder message = new StringBuilder();

Map<Boolean, List<RemoteRepository>> repoGroupByMirrors = repositories.stream()
.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()));

getLog().info(message);

Expand Down

0 comments on commit 3c877fb

Please sign in to comment.