From 76488fbb1c594611da72ae9574f89c7b6388763a Mon Sep 17 00:00:00 2001 From: Rahul Krishna Date: Thu, 23 May 2024 14:58:12 -0400 Subject: [PATCH] Fix bug in missing call edge Signed-off-by: Rahul Krishna --- .../java/com/ibm/northstar/SystemDependencyGraph.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ibm/northstar/SystemDependencyGraph.java b/src/main/java/com/ibm/northstar/SystemDependencyGraph.java index ac22e1f..420af60 100644 --- a/src/main/java/com/ibm/northstar/SystemDependencyGraph.java +++ b/src/main/java/com/ibm/northstar/SystemDependencyGraph.java @@ -174,14 +174,11 @@ private static org.jgrapht.Graph, AbstractGraphEdge> buil // Get the edge between the source and the target AbstractGraphEdge cgEdge = graph.getEdge(source, target); - - if (cgEdge == null) { + if (cgEdge instanceof CallEdge) { + ((CallEdge) cgEdge).incrementWeight(); + } else { graph.addEdge(source, target, new CallEdge()); } - // If edge exists, then increment the weight - else { - cgEdge.incrementWeight(); - } } }); });