Program: 158895
Project: 158895
Buggy source:
@Override public void playPriority(UUID activePlayerId,boolean resuming){
  int bookmark=0;
  clearAllBookmarks();
  try {
    while (!isPaused() && !gameOver(null) && !this.getTurn().isEndTurnRequested()) {
      if (!resuming) {
        state.getPlayers().resetPassed();
        state.getPlayerList().setCurrent(activePlayerId);
      }
 else {
        state.getPlayerList().setCurrent(this.getPriorityPlayerId());
      }
      fireUpdatePlayersEvent();
      Player player;
      while (!isPaused() && !gameOver(null)) {
        try {
          if (bookmark == 0) {
            bookmark=bookmarkState();
          }
          player=getPlayer(state.getPlayerList().get());
          state.setPriorityPlayerId(player.getId());
          while (!player.isPassed() && player.isInGame() && !isPaused()&& !gameOver(null)) {
            if (!resuming) {
              checkStateAndTriggered();
              applyEffects();
              if (state.getStack().isEmpty()) {
                resetLKI();
              }
              saveState(false);
              if (isPaused() || gameOver(null)) {
                return;
              }
              if (player.priority(this)) {
                if (executingRollback()) {
                  return;
                }
                applyEffects();
              }
              if (isPaused()) {
                return;
              }
            }
            resuming=false;
          }
          resetShortLivingLKI();
          resuming=false;
          if (isPaused() || gameOver(null)) {
            return;
          }
          if (allPassed()) {
            if (!state.getStack().isEmpty()) {
              resolve();
              applyEffects();
              state.getPlayers().resetPassed();
              fireUpdatePlayersEvent();
              state.getRevealed().reset();
              resetShortLivingLKI();
              break;
            }
 else {
              resetLKI();
              return;
            }
          }
        }
 catch (        Exception ex) {
          logger.fatal("String_Node_Str" + getId(),ex);
          ex.printStackTrace();
          this.fireErrorEvent("String_Node_Str",ex);
          restoreState(bookmark,"String_Node_Str");
          bookmark=0;
          continue;
        }
        state.getPlayerList().getNext();
      }
    }
  }
 catch (  Exception ex) {
    logger.fatal("String_Node_Str",ex);
    this.fireErrorEvent("String_Node_Str",ex);
  }
 finally {
    resetLKI();
    clearAllBookmarks();
  }
}

Fixed version (ground truth):
@Override public void playPriority(UUID activePlayerId,boolean resuming){
  int bookmark=0;
  clearAllBookmarks();
  try {
    applyEffects();
    while (!isPaused() && !gameOver(null) && !this.getTurn().isEndTurnRequested()) {
      if (!resuming) {
        state.getPlayers().resetPassed();
        state.getPlayerList().setCurrent(activePlayerId);
      }
 else {
        state.getPlayerList().setCurrent(this.getPriorityPlayerId());
      }
      fireUpdatePlayersEvent();
      Player player;
      while (!isPaused() && !gameOver(null)) {
        try {
          if (bookmark == 0) {
            bookmark=bookmarkState();
          }
          player=getPlayer(state.getPlayerList().get());
          state.setPriorityPlayerId(player.getId());
          while (!player.isPassed() && player.isInGame() && !isPaused()&& !gameOver(null)) {
            if (!resuming) {
              checkStateAndTriggered();
              applyEffects();
              if (state.getStack().isEmpty()) {
                resetLKI();
              }
              saveState(false);
              if (isPaused() || gameOver(null)) {
                return;
              }
              if (player.priority(this)) {
                if (executingRollback()) {
                  return;
                }
                applyEffects();
              }
              if (isPaused()) {
                return;
              }
            }
            resuming=false;
          }
          resetShortLivingLKI();
          resuming=false;
          if (isPaused() || gameOver(null)) {
            return;
          }
          if (allPassed()) {
            if (!state.getStack().isEmpty()) {
              resolve();
              applyEffects();
              state.getPlayers().resetPassed();
              fireUpdatePlayersEvent();
              state.getRevealed().reset();
              resetShortLivingLKI();
              break;
            }
 else {
              resetLKI();
              return;
            }
          }
        }
 catch (        Exception ex) {
          logger.fatal("String_Node_Str" + getId(),ex);
          ex.printStackTrace();
          this.fireErrorEvent("String_Node_Str",ex);
          restoreState(bookmark,"String_Node_Str");
          bookmark=0;
          continue;
        }
        state.getPlayerList().getNext();
      }
    }
  }
 catch (  Exception ex) {
    logger.fatal("String_Node_Str",ex);
    this.fireErrorEvent("String_Node_Str",ex);
  }
 finally {
    resetLKI();
    clearAllBookmarks();
  }
}