Program: 143071
Project: 143071
Buggy source:
public void clickNodes(Node[] nodes){
  Node n=nodes[0];
  if (sourceNode == null) {
    sourceNode=n;
    shortestPathPanel.setResult("String_Node_Str");
    shortestPathPanel.setStatus(NbBundle.getMessage(ShortestPath.class,"String_Node_Str"));
  }
 else   if (n != sourceNode) {
    color=shortestPathPanel.getColor();
    float[] colorArray=new float[]{color.getRed() / 255f,color.getGreen() / 255f,color.getBlue() / 255f};
    Node targetNode=n;
    GraphController gc=Lookup.getDefault().lookup(GraphController.class);
    DirectedGraph graph=null;
    if (gc.getModel().getGraph() instanceof DirectedGraph) {
      graph=(DirectedGraph)gc.getModel().getGraph();
    }
 else {
      return;
    }
    BellmanFordShortestPathAlgorithm algorithm=new BellmanFordShortestPathAlgorithm(graph,sourceNode);
    algorithm.compute();
    double distance;
    if ((distance=algorithm.getDistances().get(targetNode)) != Double.POSITIVE_INFINITY) {
      targetNode.getNodeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
      VizController.getInstance().selectNode(targetNode);
      Edge predecessorEdge=algorithm.getPredecessorIncoming(targetNode);
      while (predecessorEdge != null && predecessorEdge.getSource() != sourceNode) {
        predecessorEdge.getEdgeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
        VizController.getInstance().selectEdge(predecessorEdge);
        predecessorEdge.getSource().getNodeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
        VizController.getInstance().selectNode(predecessorEdge.getSource());
        predecessorEdge=algorithm.getPredecessorIncoming(predecessorEdge.getSource());
      }
      predecessorEdge.getEdgeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
      VizController.getInstance().selectEdge(predecessorEdge);
      sourceNode.getNodeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
      VizController.getInstance().selectNode(sourceNode);
      shortestPathPanel.setResult(NbBundle.getMessage(ShortestPath.class,"String_Node_Str",distance));
    }
 else {
      shortestPathPanel.setResult(NbBundle.getMessage(ShortestPath.class,"String_Node_Str"));
    }
    sourceNode=null;
    shortestPathPanel.setStatus(NbBundle.getMessage(ShortestPath.class,"String_Node_Str"));
  }
}

Fixed version (ground truth):
public void clickNodes(Node[] nodes){
  Node n=nodes[0];
  if (sourceNode == null) {
    sourceNode=n;
    shortestPathPanel.setResult("String_Node_Str");
    shortestPathPanel.setStatus(NbBundle.getMessage(ShortestPath.class,"String_Node_Str"));
  }
 else   if (n != sourceNode) {
    color=shortestPathPanel.getColor();
    float[] colorArray=new float[]{color.getRed() / 255f,color.getGreen() / 255f,color.getBlue() / 255f};
    Node targetNode=n;
    GraphController gc=Lookup.getDefault().lookup(GraphController.class);
    DirectedGraph graph=null;
    if (gc.getModel().getGraphVisible() instanceof DirectedGraph) {
      graph=(DirectedGraph)gc.getModel().getGraphVisible();
    }
 else {
      return;
    }
    BellmanFordShortestPathAlgorithm algorithm=new BellmanFordShortestPathAlgorithm(graph,sourceNode);
    algorithm.compute();
    double distance;
    if ((distance=algorithm.getDistances().get(targetNode)) != Double.POSITIVE_INFINITY) {
      targetNode.getNodeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
      VizController.getInstance().selectNode(targetNode);
      Edge predecessorEdge=algorithm.getPredecessorIncoming(targetNode);
      while (predecessorEdge != null && predecessorEdge.getSource() != sourceNode) {
        predecessorEdge.getEdgeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
        VizController.getInstance().selectEdge(predecessorEdge);
        predecessorEdge.getSource().getNodeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
        VizController.getInstance().selectNode(predecessorEdge.getSource());
        predecessorEdge=algorithm.getPredecessorIncoming(predecessorEdge.getSource());
      }
      predecessorEdge.getEdgeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
      VizController.getInstance().selectEdge(predecessorEdge);
      sourceNode.getNodeData().setColor(colorArray[0],colorArray[1],colorArray[2]);
      VizController.getInstance().selectNode(sourceNode);
      shortestPathPanel.setResult(NbBundle.getMessage(ShortestPath.class,"String_Node_Str",distance));
    }
 else {
      shortestPathPanel.setResult(NbBundle.getMessage(ShortestPath.class,"String_Node_Str"));
    }
    sourceNode=null;
    shortestPathPanel.setStatus(NbBundle.getMessage(ShortestPath.class,"String_Node_Str"));
  }
}