Fix ArrayOutOfBounds
@@ -179,7 +179,7 @@ public class DependencyGraphBuilder {
logger.info("Adding dependency graph edges");
var idx = new AtomicLong(0);
- dependencies.entrySet().parallelStream().map(e -> {
+ var graphEdges = dependencies.entrySet().parallelStream().map(e -> {
var source = e.getKey();
var edges = new ArrayList<Triple<Revision, Revision, DependencyEdge>>();
for (var dependency : e.getValue()) {
@@ -195,7 +195,8 @@ public class DependencyGraphBuilder {
return edges;
}
return new ArrayList<Triple<Revision, Revision, DependencyEdge>>();
- }).flatMap(Collection::stream).forEach(e -> dependencyGraph.addEdge(e.getLeft(), e.getMiddle(), e.getRight()));
+ }).flatMap(Collection::stream).collect(Collectors.toList());
+ graphEdges.forEach(e -> dependencyGraph.addEdge(e.getLeft(), e.getMiddle(), e.getRight()));
logger.info("Created graph: {} ms", System.currentTimeMillis() - startTs);
logger.info("Successfully generated ecosystem-wide dependency graph");
