Program: 190398
Project: 190398
Buggy source:
public void clickNodes(Node[] nodes){
  try {
    Node n=nodes[0];
    Color[] colors;
    float[] positions;
    if (heatMapPanel.isUsePalette()) {
      colors=heatMapPanel.getSelectedPalette().getColors();
      positions=heatMapPanel.getSelectedPalette().getPositions();
      dontPaintUnreachable=true;
    }
 else {
      gradientColors=colors=heatMapPanel.getGradientColors();
      gradientPositions=positions=heatMapPanel.getGradientPositions();
      dontPaintUnreachable=heatMapPanel.isDontPaintUnreachable();
    }
    GraphController gc=Lookup.getDefault().lookup(GraphController.class);
    DirectedGraph graph=null;
    if (gc.getModel().getGraph() instanceof DirectedGraph) {
      graph=(DirectedGraph)gc.getModel().getGraph();
    }
 else {
      return;
    }
    LinearGradient linearGradient=new LinearGradient(colors,positions);
    BellmanFordShortestPathAlgorithm algorithm=new BellmanFordShortestPathAlgorithm(graph,n);
    algorithm.compute();
    double maxDistance=algorithm.getMaxDistance();
    if (!dontPaintUnreachable) {
      maxDistance++;
    }
    if (maxDistance > 0) {
      for (      Entry<Node,Double> entry : algorithm.getDistances().entrySet()) {
        NodeData node=entry.getKey().getNodeData();
        if (!Double.isInfinite(entry.getValue())) {
          float ratio=(float)(entry.getValue() / maxDistance);
          Color c=linearGradient.getValue(ratio);
          node.setColor(c.getRed() / 255f,c.getGreen() / 255f,c.getBlue() / 255f);
        }
 else         if (!dontPaintUnreachable) {
          Color c=colors[colors.length - 1];
          node.setColor(c.getRed() / 255f,c.getGreen() / 255f,c.getBlue() / 255f);
        }
      }
    }
    Color c=colors[0];
    n.getNodeData().setColor(c.getRed() / 255f,c.getGreen() / 255f,c.getBlue() / 255f);
    heatMapPanel.setStatus(NbBundle.getMessage(HeatMap.class,"String_Node_Str") + new DecimalFormat("String_Node_Str").format(algorithm.getMaxDistance()));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void clickNodes(Node[] nodes){
  try {
    Node n=nodes[0];
    Color[] colors;
    float[] positions;
    if (heatMapPanel.isUsePalette()) {
      colors=heatMapPanel.getSelectedPalette().getColors();
      positions=heatMapPanel.getSelectedPalette().getPositions();
      dontPaintUnreachable=true;
    }
 else {
      gradientColors=colors=heatMapPanel.getGradientColors();
      gradientPositions=positions=heatMapPanel.getGradientPositions();
      dontPaintUnreachable=heatMapPanel.isDontPaintUnreachable();
    }
    GraphController gc=Lookup.getDefault().lookup(GraphController.class);
    DirectedGraph graph=null;
    if (gc.getModel().getGraphVisible() instanceof DirectedGraph) {
      graph=(DirectedGraph)gc.getModel().getGraphVisible();
    }
 else {
      return;
    }
    LinearGradient linearGradient=new LinearGradient(colors,positions);
    BellmanFordShortestPathAlgorithm algorithm=new BellmanFordShortestPathAlgorithm(graph,n);
    algorithm.compute();
    double maxDistance=algorithm.getMaxDistance();
    if (!dontPaintUnreachable) {
      maxDistance++;
    }
    if (maxDistance > 0) {
      for (      Entry<Node,Double> entry : algorithm.getDistances().entrySet()) {
        NodeData node=entry.getKey().getNodeData();
        if (!Double.isInfinite(entry.getValue())) {
          float ratio=(float)(entry.getValue() / maxDistance);
          Color c=linearGradient.getValue(ratio);
          node.setColor(c.getRed() / 255f,c.getGreen() / 255f,c.getBlue() / 255f);
        }
 else         if (!dontPaintUnreachable) {
          Color c=colors[colors.length - 1];
          node.setColor(c.getRed() / 255f,c.getGreen() / 255f,c.getBlue() / 255f);
        }
      }
    }
    Color c=colors[0];
    n.getNodeData().setColor(c.getRed() / 255f,c.getGreen() / 255f,c.getBlue() / 255f);
    heatMapPanel.setStatus(NbBundle.getMessage(HeatMap.class,"String_Node_Str") + new DecimalFormat("String_Node_Str").format(algorithm.getMaxDistance()));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}