Program: 142530
Project: 142530
Buggy source:
public void execute(HierarchicalGraph graph,AttributeModel attributeModel){
  isDirected=graph instanceof DirectedGraph;
  isCanceled=false;
  degreeDist=new HashMap<Float,Integer>();
  inDegreeDist=new HashMap<Float,Integer>();
  outDegreeDist=new HashMap<Float,Integer>();
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn degCol=nodeTable.getColumn(WDEGREE);
  AttributeColumn inCol=nodeTable.getColumn(WINDEGREE);
  AttributeColumn outCol=nodeTable.getColumn(WOUTDEGREE);
  if (degCol == null) {
    degCol=nodeTable.addColumn(WDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
  }
  if (isDirected) {
    if (inCol == null) {
      inCol=nodeTable.addColumn(WINDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
    }
    if (outCol == null) {
      outCol=nodeTable.addColumn(WOUTDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
    }
  }
  graph.readLock();
  Progress.start(progress,graph.getNodeCount());
  int i=0;
  for (  Node n : graph.getNodes()) {
    AttributeRow row=(AttributeRow)n.getNodeData().getAttributes();
    float totalWeight=0;
    for (Iterator it=graph.getEdgesAndMetaEdges(n).iterator(); it.hasNext(); ) {
      Edge e=(Edge)it.next();
      totalWeight+=e.getWeight();
    }
    if (isDirected) {
      HierarchicalDirectedGraph hdg=graph.getGraphModel().getHierarchicalDirectedGraph();
      float totalInWeight=0;
      float totalOutWeight=0;
      for (Iterator it=graph.getEdgesAndMetaEdges(n).iterator(); it.hasNext(); ) {
        Edge e=(Edge)it.next();
        if (e.getSource().equals(n)) {
          totalOutWeight+=e.getWeight();
        }
        if (e.getTarget().equals(n)) {
          totalInWeight+=e.getWeight();
        }
      }
      row.setValue(inCol,totalInWeight);
      row.setValue(outCol,totalOutWeight);
      if (!inDegreeDist.containsKey(totalInWeight)) {
        inDegreeDist.put(totalInWeight,0);
      }
      inDegreeDist.put(totalInWeight,inDegreeDist.get(totalInWeight) + 1);
      if (!outDegreeDist.containsKey(totalOutWeight)) {
        outDegreeDist.put(totalOutWeight,0);
      }
      outDegreeDist.put(totalOutWeight,outDegreeDist.get(totalOutWeight) + 1);
    }
    row.setValue(degCol,totalWeight);
    avgWDegree+=totalWeight;
    if (!degreeDist.containsKey(totalWeight)) {
      degreeDist.put(totalWeight,0);
    }
    degreeDist.put(totalWeight,degreeDist.get(totalWeight) + 1);
    if (isCanceled) {
      break;
    }
    i++;
    Progress.progress(progress,i);
  }
  avgWDegree/=graph.getNodeCount();
  graph.readUnlockAll();
}

Fixed version (ground truth):
public void execute(HierarchicalGraph graph,AttributeModel attributeModel){
  isDirected=graph instanceof DirectedGraph;
  isCanceled=false;
  degreeDist=new HashMap<Float,Integer>();
  inDegreeDist=new HashMap<Float,Integer>();
  outDegreeDist=new HashMap<Float,Integer>();
  AttributeTable nodeTable=attributeModel.getNodeTable();
  AttributeColumn degCol=nodeTable.getColumn(WDEGREE);
  AttributeColumn inCol=nodeTable.getColumn(WINDEGREE);
  AttributeColumn outCol=nodeTable.getColumn(WOUTDEGREE);
  if (degCol == null) {
    degCol=nodeTable.addColumn(WDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
  }
  if (isDirected) {
    if (inCol == null) {
      inCol=nodeTable.addColumn(WINDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
    }
    if (outCol == null) {
      outCol=nodeTable.addColumn(WOUTDEGREE,"String_Node_Str",AttributeType.INT,AttributeOrigin.COMPUTED,0);
    }
  }
  graph.readLock();
  Progress.start(progress,graph.getNodeCount());
  int i=0;
  for (  Node n : graph.getNodes()) {
    AttributeRow row=(AttributeRow)n.getNodeData().getAttributes();
    float totalWeight=0;
    if (isDirected) {
      HierarchicalDirectedGraph hdg=graph.getGraphModel().getHierarchicalDirectedGraph();
      float totalInWeight=0;
      float totalOutWeight=0;
      for (Iterator it=graph.getEdgesAndMetaEdges(n).iterator(); it.hasNext(); ) {
        Edge e=(Edge)it.next();
        if (e.getSource().equals(n)) {
          totalOutWeight+=e.getWeight();
        }
        if (e.getTarget().equals(n)) {
          totalInWeight+=e.getWeight();
        }
      }
      totalWeight=totalInWeight + totalOutWeight;
      row.setValue(inCol,totalInWeight);
      row.setValue(outCol,totalOutWeight);
      if (!inDegreeDist.containsKey(totalInWeight)) {
        inDegreeDist.put(totalInWeight,0);
      }
      inDegreeDist.put(totalInWeight,inDegreeDist.get(totalInWeight) + 1);
      if (!outDegreeDist.containsKey(totalOutWeight)) {
        outDegreeDist.put(totalOutWeight,0);
      }
      outDegreeDist.put(totalOutWeight,outDegreeDist.get(totalOutWeight) + 1);
    }
 else {
      for (Iterator it=graph.getEdgesAndMetaEdges(n).iterator(); it.hasNext(); ) {
        Edge e=(Edge)it.next();
        totalWeight+=e.getWeight();
      }
    }
    row.setValue(degCol,totalWeight);
    avgWDegree+=totalWeight;
    if (!degreeDist.containsKey(totalWeight)) {
      degreeDist.put(totalWeight,0);
    }
    degreeDist.put(totalWeight,degreeDist.get(totalWeight) + 1);
    if (isCanceled) {
      break;
    }
    i++;
    Progress.progress(progress,i);
  }
  avgWDegree/=(isDirected) ? 2 * graph.getNodeCount() : graph.getNodeCount();
  graph.readUnlockAll();
}