Program: 19781
Project: 19781
Buggy source:
/** 
 * Collects the next set of emitting tokens from a token and accumulates them in the active or result lists
 * @param token the token to collect successors from be immediately expaned are placed. Null if we should always expand all nodes.
 */
protected void collectSuccessorTokens(Token token){
  if (token.isFinal()) {
    resultList.add(getWordPredecessor(token));
    return;
  }
  SearchState state=token.getSearchState();
  SearchStateArc[] arcs=state.getSuccessors();
  Token predecessor=getWordPredecessor(token);
  for (int i=0; i < arcs.length; i++) {
    SearchStateArc arc=arcs[i];
    SearchState nextState=arc.getState();
    if (checkStateOrder) {
      checkStateOrder(state,nextState);
    }
    float logEntryScore=token.getScore() + arc.getProbability();
    Token bestToken=getBestToken(nextState);
    boolean firstToken=bestToken == null;
    if (firstToken || bestToken.getScore() < logEntryScore) {
      Token newBestToken=new Token(predecessor,nextState,logEntryScore,arc.getLanguageProbability(),arc.getInsertionProbability(),currentFrameNumber);
      tokensCreated.value++;
      setBestToken(newBestToken,nextState);
      if (firstToken) {
        activeListAdd(newBestToken);
      }
 else {
        if (false) {
          System.out.println("String_Node_Str" + bestToken + "String_Node_Str"+ newBestToken);
        }
        activeListReplace(bestToken,newBestToken);
        if (buildWordLattice && newBestToken.isWord()) {
          loserManager.changeSuccessor(newBestToken,bestToken);
          loserManager.addAlternatePredecessor(newBestToken,bestToken.getPredecessor());
        }
      }
    }
 else {
      if (buildWordLattice && nextState instanceof WordSearchState) {
        if (predecessor != null) {
          loserManager.addAlternatePredecessor(bestToken,predecessor);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Collects the next set of emitting tokens from a token and accumulates them in the active or result lists
 * @param token the token to collect successors from be immediately expaned are placed. Null if we should always expand all nodes.
 */
protected void collectSuccessorTokens(Token token){
  if (token.isFinal()) {
    resultList.add(getWordPredecessor(token));
    return;
  }
  if (!token.isEmitting() && (keepAllTokens && isVisited(token))) {
    return;
  }
  SearchState state=token.getSearchState();
  SearchStateArc[] arcs=state.getSuccessors();
  Token predecessor=getWordPredecessor(token);
  for (int i=0; i < arcs.length; i++) {
    SearchStateArc arc=arcs[i];
    SearchState nextState=arc.getState();
    if (checkStateOrder) {
      checkStateOrder(state,nextState);
    }
    float logEntryScore=token.getScore() + arc.getProbability();
    Token bestToken=getBestToken(nextState);
    boolean firstToken=bestToken == null;
    if (firstToken || bestToken.getScore() < logEntryScore) {
      Token newBestToken=new Token(predecessor,nextState,logEntryScore,arc.getLanguageProbability(),arc.getInsertionProbability(),currentFrameNumber);
      tokensCreated.value++;
      setBestToken(newBestToken,nextState);
      if (firstToken) {
        activeListAdd(newBestToken);
      }
 else {
        if (false) {
          System.out.println("String_Node_Str" + bestToken + "String_Node_Str"+ newBestToken);
        }
        activeListReplace(bestToken,newBestToken);
        if (buildWordLattice && newBestToken.isWord()) {
          loserManager.changeSuccessor(newBestToken,bestToken);
          loserManager.addAlternatePredecessor(newBestToken,bestToken.getPredecessor());
        }
      }
    }
 else {
      if (buildWordLattice && nextState instanceof WordSearchState) {
        if (predecessor != null) {
          loserManager.addAlternatePredecessor(bestToken,predecessor);
        }
      }
    }
  }
}