Program: 161849
Project: 161849
Buggy source:
public void run(Document document,String type){
  try {
    NamedEntitiesInText namedEntities=document.getNamedEntitiesInText();
    algorithmicResult=new HashMap<Integer,String>();
    DirectedSparseGraph<Node,String> graph=new DirectedSparseGraph<Node,String>();
    log.debug("String_Node_Str");
    cu.insertCandidatesIntoText(graph,document,threshholdTrigram,heuristicExpansionOn);
    log.info("String_Node_Str" + graph.getVertexCount());
    BreadthFirstSearch bfs=new BreadthFirstSearch(index);
    bfs.run(maxDepth,graph,edgeType,nodeType);
    log.info("String_Node_Str" + graph.getVertexCount());
    log.debug("String_Node_Str");
    HITS h=new HITS();
    h.runHits(graph,20);
    log.debug("String_Node_Str");
    ArrayList<Node> orderedList=new ArrayList<Node>();
    orderedList.addAll(graph.getVertices());
    Collections.sort(orderedList);
    for (    NamedEntityInText entity : namedEntities) {
      for (int i=0; i < orderedList.size(); i++) {
        Node m=orderedList.get(i);
        if (m.containsId(entity.getStartPos())) {
          if (!algorithmicResult.containsKey(entity.getStartPos())) {
            algorithmicResult.put(entity.getStartPos(),m.getCandidateURI());
            break;
          }
        }
      }
    }
    if (type.equals("String_Node_Str")) {
      for (      NamedEntityInText entity : namedEntities) {
        for (int i=0; i < orderedList.size(); i++) {
          Node m=orderedList.get(i);
          if (m.containsId(entity.getStartPos())) {
            CandidatesScore candidates=new CandidatesScore();
            candidates.setStart(entity.getStartPos());
            candidates.setUri(m.getCandidateURI());
            candidates.setScore(m.getAuthorityWeight());
            ListCandidates.add(candidates);
          }
        }
      }
    }
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void run(Document document,Map<NamedEntityInText,List<CandidatesScore>> candidatesPerNE){
  try {
    NamedEntitiesInText namedEntities=document.getNamedEntitiesInText();
    DirectedSparseGraph<Node,String> graph=new DirectedSparseGraph<Node,String>();
    log.debug("String_Node_Str");
    cu.insertCandidatesIntoText(graph,document,threshholdTrigram,heuristicExpansionOn);
    log.info("String_Node_Str" + graph.getVertexCount());
    BreadthFirstSearch bfs=new BreadthFirstSearch(index);
    bfs.run(maxDepth,graph,edgeType,nodeType);
    log.info("String_Node_Str" + graph.getVertexCount());
    log.debug("String_Node_Str");
    HITS h=new HITS();
    h.runHits(graph,20);
    PageRank pr=new PageRank();
    pr.runPr(graph,100,0.001);
    log.debug("String_Node_Str");
    ArrayList<Node> orderedList=new ArrayList<Node>();
    orderedList.addAll(graph.getVertices());
    Collections.sort(orderedList);
    for (    NamedEntityInText entity : namedEntities) {
      for (int i=0; i < orderedList.size(); i++) {
        Node m=orderedList.get(i);
        if (m.containsId(entity.getStartPos())) {
          entity.setNamedEntity(m.getCandidateURI());
          break;
        }
      }
    }
    if (candidatesPerNE != null) {
      List<CandidatesScore> listCandidates=new ArrayList<>();
      for (      NamedEntityInText entity : namedEntities) {
        for (int i=0; i < orderedList.size(); i++) {
          Node m=orderedList.get(i);
          if (m.containsId(entity.getStartPos())) {
            CandidatesScore candidates=new CandidatesScore();
            candidates.setStart(entity.getStartPos());
            candidates.setUri(m.getCandidateURI());
            candidates.setScore(m.getAuthorityWeight());
            listCandidates.add(candidates);
          }
        }
        candidatesPerNE.put(entity,listCandidates);
      }
    }
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}