Program: 161838
Project: 161838
Buggy source:
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());
    if (algorithm.equals("String_Node_Str")) {
      log.info("String_Node_Str");
      HITS h=new HITS();
      h.runHits(graph,20);
    }
 else     if (algorithm.equals("String_Node_Str")) {
      log.info("String_Node_Str");
      PageRank pr=new PageRank();
      pr.runPr(graph,50,0.1);
    }
    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);
  }
}

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,algorithm);
    bfs.run(maxDepth,graph,edgeType,nodeType);
    log.info("String_Node_Str" + graph.getVertexCount());
    if (algorithm.equals("String_Node_Str")) {
      log.info("String_Node_Str");
      HITS h=new HITS();
      h.runHits(graph,20);
    }
 else     if (algorithm.equals("String_Node_Str")) {
      log.info("String_Node_Str");
      PageRank pr=new PageRank();
      pr.runPr(graph,50,0.1);
    }
    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);
  }
}