Program: 189833
Project: 189833
Buggy source:
public AbstractEdge[] flattenNode(AbstractNode node){
  AbstractEdge[] newEdges=null;
  if (!node.getMetaEdgesInTree().isEmpty() || !node.getMetaEdgesOutTree().isEmpty()) {
    newEdges=new AbstractEdge[node.getMetaEdgesInTree().getCount() + node.getMetaEdgesOutTree().getCount()];
  }
  int i=0;
  if (!node.getMetaEdgesInTree().isEmpty()) {
    for (edgeIterator.setNode(node.getMetaEdgesInTree()); edgeIterator.hasNext(); ) {
      AbstractEdge edge=edgeIterator.next();
      AbstractNode source=edge.getSource(viewId);
      edgeIterator.remove();
      source.getMetaEdgesOutTree().remove((MetaEdgeImpl)edge);
      view.decMetaEdgesCount(1);
      if (!node.getEdgesInTree().hasNeighbour(source)) {
        AbstractEdge realEdge=dhns.factory().newEdge(source,node,edge.getWeight(),edge.isDirected());
        realEdge.getEdgeData().moveFrom(edge.getEdgeData());
        realEdge.setWeight(edge.getWeight());
        newEdges[i]=realEdge;
        source.getEdgesOutTree().add(realEdge);
        node.getEdgesInTree().add(realEdge);
        source.incEnabledOutDegree();
        node.incEnabledInDegree();
        view.incEdgesCountEnabled(1);
        view.incEdgesCountTotal(1);
        if (source.getEdgesInTree().hasNeighbour(node)) {
          source.incEnabledMutualDegree();
          node.incEnabledMutualDegree();
          view.incMutualEdgesEnabled(1);
          view.incMutualEdgesTotal(1);
        }
      }
      i++;
    }
  }
  if (!node.getMetaEdgesOutTree().isEmpty()) {
    for (edgeIterator.setNode(node.getMetaEdgesOutTree()); edgeIterator.hasNext(); ) {
      AbstractEdge edge=edgeIterator.next();
      AbstractNode target=edge.getTarget(viewId);
      edgeIterator.remove();
      target.getMetaEdgesInTree().remove((MetaEdgeImpl)edge);
      view.decMetaEdgesCount(1);
      if (!node.getEdgesOutTree().hasNeighbour(target)) {
        AbstractEdge realEdge=dhns.factory().newEdge(node,target,edge.getWeight(),edge.isDirected());
        realEdge.getEdgeData().moveFrom(edge.getEdgeData());
        realEdge.setWeight(edge.getWeight());
        newEdges[i]=realEdge;
        node.getEdgesOutTree().add(realEdge);
        target.getEdgesInTree().add(realEdge);
        node.incEnabledOutDegree();
        target.incEnabledInDegree();
        view.incEdgesCountEnabled(1);
        view.incEdgesCountTotal(1);
        if (target.getEdgesOutTree().hasNeighbour(node)) {
          node.incEnabledMutualDegree();
          target.incEnabledMutualDegree();
          view.incMutualEdgesEnabled(1);
          view.incMutualEdgesTotal(1);
        }
      }
      i++;
    }
  }
  view.decMutualMetaEdgesTotal(node.getMutualMetaEdgeDegree());
  node.setMutualMetaEdgeDegree(0);
  return newEdges;
}

Fixed version (ground truth):
public AbstractEdge[] flattenNode(AbstractNode node){
  AbstractEdge[] newEdges=null;
  if (!node.getMetaEdgesInTree().isEmpty() || !node.getMetaEdgesOutTree().isEmpty()) {
    newEdges=new AbstractEdge[node.getMetaEdgesInTree().getCount() + node.getMetaEdgesOutTree().getCount()];
  }
  int i=0;
  if (!node.getMetaEdgesInTree().isEmpty()) {
    for (edgeIterator.setNode(node.getMetaEdgesInTree()); edgeIterator.hasNext(); ) {
      AbstractEdge edge=edgeIterator.next();
      AbstractNode source=edge.getSource(viewId);
      edgeIterator.remove();
      source.getMetaEdgesOutTree().remove((MetaEdgeImpl)edge);
      view.decMetaEdgesCount(1);
      if (node.getMetaEdgesOutTree().hasNeighbour(source)) {
        source.decMutualMetaEdgeDegree();
      }
      if (!node.getEdgesInTree().hasNeighbour(source)) {
        AbstractEdge realEdge=dhns.factory().newEdge(source,node,edge.getWeight(),edge.isDirected());
        realEdge.getEdgeData().moveFrom(edge.getEdgeData());
        realEdge.setWeight(edge.getWeight());
        newEdges[i]=realEdge;
        source.getEdgesOutTree().add(realEdge);
        node.getEdgesInTree().add(realEdge);
        source.incEnabledOutDegree();
        node.incEnabledInDegree();
        view.incEdgesCountEnabled(1);
        view.incEdgesCountTotal(1);
        if (source.getEdgesInTree().hasNeighbour(node)) {
          source.incEnabledMutualDegree();
          node.incEnabledMutualDegree();
          view.incMutualEdgesEnabled(1);
          view.incMutualEdgesTotal(1);
        }
      }
      i++;
    }
  }
  if (!node.getMetaEdgesOutTree().isEmpty()) {
    for (edgeIterator.setNode(node.getMetaEdgesOutTree()); edgeIterator.hasNext(); ) {
      AbstractEdge edge=edgeIterator.next();
      AbstractNode target=edge.getTarget(viewId);
      edgeIterator.remove();
      target.getMetaEdgesInTree().remove((MetaEdgeImpl)edge);
      view.decMetaEdgesCount(1);
      if (!node.getEdgesOutTree().hasNeighbour(target)) {
        AbstractEdge realEdge=dhns.factory().newEdge(node,target,edge.getWeight(),edge.isDirected());
        realEdge.getEdgeData().moveFrom(edge.getEdgeData());
        realEdge.setWeight(edge.getWeight());
        newEdges[i]=realEdge;
        node.getEdgesOutTree().add(realEdge);
        target.getEdgesInTree().add(realEdge);
        node.incEnabledOutDegree();
        target.incEnabledInDegree();
        view.incEdgesCountEnabled(1);
        view.incEdgesCountTotal(1);
        if (target.getEdgesOutTree().hasNeighbour(node)) {
          node.incEnabledMutualDegree();
          target.incEnabledMutualDegree();
          view.incMutualEdgesEnabled(1);
          view.incMutualEdgesTotal(1);
        }
      }
      i++;
    }
  }
  view.decMutualMetaEdgesTotal(node.getMutualMetaEdgeDegree());
  node.setMutualMetaEdgeDegree(0);
  return newEdges;
}