Program: 99083
Project: 99083
Buggy source:
protected void mongoDB2Graph() throws Exception {
  pc=Lookup.getDefault().lookup(ProjectController.class);
  pc.newProject();
  workspace=pc.getCurrentWorkspace();
  graphModel=Lookup.getDefault().lookup(GraphController.class).getModel();
  undirectedGraph=graphModel.getUndirectedGraph();
  BasicDBList friends=(BasicDBList)this.fb_profile.get("String_Node_Str");
  nodes=new Node[friends.size() * 2];
  friendHash=new HashMap<Long,Integer>();
  Iterator itr=friends.iterator();
  BasicDBObject friend=new BasicDBObject();
  int idx=0;
  while (itr.hasNext()) {
    friend=(BasicDBObject)itr.next();
    long uid=Long.valueOf(friend.get("String_Node_Str").toString());
    String name=friend.get("String_Node_Str").toString();
    friendHash.put(new Long(uid),new Integer(idx));
    String suid="String_Node_Str" + uid;
    Node n0=graphModel.factory().newNode(suid);
    n0.getNodeData().setLabel(name);
    undirectedGraph.addNode(n0);
    nodes[idx]=n0;
    idx++;
  }
  friendHash.put(new Long(userUid),idx);
  Node nego=graphModel.factory().newNode("String_Node_Str" + userUid);
  nego.getNodeData().setLabel(userName);
  undirectedGraph.addNode(nego);
  nodes[idx]=nego;
  idx++;
  System.out.println(friend);
  System.out.println(friend.get("String_Node_Str"));
  System.out.println(friends.size());
  BasicDBList edges=(BasicDBList)this.fb_profile.get("String_Node_Str");
  System.out.println(edges.toArray()[0].getClass().getName());
  itr=edges.iterator();
  BasicDBObject edge;
  while (itr.hasNext()) {
    edge=(BasicDBObject)itr.next();
    long node1=Long.valueOf(edge.get("String_Node_Str").toString());
    long node2=Long.valueOf(edge.get("String_Node_Str").toString());
    if (node2 > node1) {
      int idx1=(Integer)friendHash.get(node1);
      int idx2=(Integer)friendHash.get(node2);
      Edge e1=graphModel.factory().newEdge(nodes[idx1],nodes[idx2]);
      undirectedGraph.addEdge(e1);
    }
  }
  for (int i1=0; i1 < friends.size(); i1++) {
    Edge e2=graphModel.factory().newEdge(nodes[i1],nego);
    undirectedGraph.addEdge(e2);
  }
  System.out.println(edges.size());
}

Fixed version (ground truth):
protected void mongoDB2Graph() throws Exception {
  pc=Lookup.getDefault().lookup(ProjectController.class);
  pc.newProject();
  workspace=pc.getCurrentWorkspace();
  graphModel=Lookup.getDefault().lookup(GraphController.class).getModel();
  undirectedGraph=graphModel.getUndirectedGraph();
  BasicDBList friends=(BasicDBList)this.fb_profile.get("String_Node_Str");
  nodes=new Node[friends.size() * 2];
  friendHash=new HashMap<Long,Integer>();
  Iterator itr=friends.iterator();
  BasicDBObject friend=new BasicDBObject();
  int idx=0;
  while (itr.hasNext()) {
    friend=(BasicDBObject)itr.next();
    long uid=Long.valueOf(friend.get("String_Node_Str").toString());
    String name=friend.get("String_Node_Str").toString();
    friendHash.put(new Long(uid),new Integer(idx));
    String suid="String_Node_Str" + uid;
    Node n0=graphModel.factory().newNode(suid);
    n0.getNodeData().setLabel(name);
    undirectedGraph.addNode(n0);
    nodes[idx]=n0;
    idx++;
  }
  friendHash.put(new Long(userUid),idx);
  Node nego=graphModel.factory().newNode("String_Node_Str" + userUid);
  nego.getNodeData().setLabel(userName);
  undirectedGraph.addNode(nego);
  nodes[idx]=nego;
  idx++;
  System.out.println(friend);
  System.out.println(friend.get("String_Node_Str"));
  System.out.println(friends.size());
  BasicDBList edges=(BasicDBList)this.fb_profile.get("String_Node_Str");
  if (edges.size() > 0)   System.out.println(edges.toArray()[0].getClass().getName());
  itr=edges.iterator();
  BasicDBObject edge;
  while (itr.hasNext()) {
    edge=(BasicDBObject)itr.next();
    long node1=Long.valueOf(edge.get("String_Node_Str").toString());
    long node2=Long.valueOf(edge.get("String_Node_Str").toString());
    if (node2 > node1) {
      int idx1=(Integer)friendHash.get(node1);
      int idx2=(Integer)friendHash.get(node2);
      Edge e1=graphModel.factory().newEdge(nodes[idx1],nodes[idx2]);
      undirectedGraph.addEdge(e1);
    }
  }
  for (int i1=0; i1 < friends.size(); i1++) {
    Edge e2=graphModel.factory().newEdge(nodes[i1],nego);
    undirectedGraph.addEdge(e2);
  }
  System.out.println(edges.size());
}