Program: 37872
Project: 37872
Buggy source:
protected Transition computeResultTransition(RealCheck<?,?> check,CheckState currentState,ResultMO resultMO){
  Status resultStatus=Status.parse(resultMO.getStatus());
  if (resultMO.isOk() != resultStatus.isOk()) {
    resultMO.setOk(resultStatus.isOk());
  }
  boolean hasDependencies=!check.getDependsIds().isEmpty();
  boolean dependenciesAreAllHard=true;
  boolean dependenciesAreAllOk=true;
  UUID encompassingAlertId=null;
  if (hasDependencies) {
    for (    Check<?,?> dependency : check.getDepends()) {
      CheckState dependencyState=dependency.getState();
      dependenciesAreAllHard&=dependencyState.isHard();
      dependenciesAreAllOk&=dependencyState.isHardOk();
      if (dependencyState.isHardNotOk() && encompassingAlertId == null)       encompassingAlertId=dependencyState.getCurrentAlertId();
    }
    logger.debug("String_Node_Str" + check.getId() + "String_Node_Str"+ dependenciesAreAllHard+ "String_Node_Str"+ dependenciesAreAllOk);
  }
  CheckState nextState=currentState.clone();
  nextState.setOk(resultMO.isOk());
  nextState.pushOkHistory(resultMO.isOk());
  nextState.setStatus(resultStatus);
  nextState.setOutput(resultMO.getOutput());
  nextState.setLastCheckTime(new Timestamp(resultMO.getExecuted()));
  nextState.setInDowntime(check.isInDowntime());
  nextState.setSuppressed(check.isSuppressed());
  if (currentState.getCurrentAlertId() != null) {
    Alert currentAlert=currentState.getCurrentAlert();
    currentState.setAcknowledged(currentAlert.isAcknowledged());
  }
  nextState.setEncompassed(dependenciesAreAllHard && (!dependenciesAreAllOk));
  if (currentState.isOk() ^ nextState.isOk()) {
    if (currentState.isHard()) {
      nextState.setLastHardOk(currentState.isOk());
      nextState.setLastHardStatus(currentState.getStatus());
      nextState.setLastHardOutput(currentState.getOutput());
    }
    nextState.setLastStateChange(new Timestamp(System.currentTimeMillis()));
    if (check.computeCurrentAttemptThreshold(nextState) <= 1 && ((!hasDependencies) || dependenciesAreAllHard)) {
      nextState.setHard(true);
      nextState.setTransitioning(false);
      nextState.setAttempt(check.computeCurrentAttemptThreshold(nextState));
      if (nextState.isAlert()) {
        nextState.setCurrentAlertId(encompassingAlertId == null ? Site.randomId(check.getSiteId()) : encompassingAlertId);
        nextState.setAcknowledged(false);
      }
      if (nextState.isRecovery()) {
        nextState.setCurrentAlertId(null);
        nextState.setAcknowledged(false);
      }
      return new Transition().previousState(currentState).nextState(nextState).stateChange(true).hardChange(true).alert(nextState.isAlert()).recovery(nextState.isRecovery());
    }
 else {
      nextState.setHard(false);
      nextState.setTransitioning(true);
      nextState.setAttempt(1);
      return new Transition().previousState(currentState).nextState(nextState).stateChange(true).hardChange(false).alert(false).recovery(false);
    }
  }
 else   if (currentState.isHard()) {
    return new Transition().previousState(currentState).nextState(nextState).stateChange(false).hardChange(false).alert(false).recovery(false);
  }
 else {
    nextState.setAttempt(currentState.getAttempt() + 1);
    if (nextState.getAttempt() >= check.computeCurrentAttemptThreshold(nextState) && ((!hasDependencies) || dependenciesAreAllHard)) {
      nextState.setHard(true);
      nextState.setTransitioning(false);
      nextState.setAttempt(check.computeCurrentAttemptThreshold(nextState));
      if (nextState.isAlert()) {
        nextState.setCurrentAlertId(encompassingAlertId == null ? Site.randomId(check.getSiteId()) : encompassingAlertId);
        nextState.setAcknowledged(false);
      }
      if (nextState.isRecovery()) {
        nextState.setCurrentAlertId(null);
        nextState.setAcknowledged(false);
      }
      return new Transition().previousState(currentState).nextState(nextState).stateChange(false).hardChange(true).alert(nextState.isAlert()).recovery(nextState.isRecovery());
    }
 else {
      return new Transition().previousState(currentState).nextState(nextState).stateChange(false).hardChange(false).alert(false).recovery(false);
    }
  }
}

Fixed version (ground truth):
protected Transition computeResultTransition(RealCheck<?,?> check,CheckState currentState,ResultMO resultMO){
  Status resultStatus=Status.parse(resultMO.getStatus());
  if (resultMO.isOk() != resultStatus.isOk()) {
    resultMO.setOk(resultStatus.isOk());
  }
  boolean hasDependencies=check.hasDependencies();
  boolean dependenciesAreAllHard=true;
  boolean dependenciesAreAllOk=true;
  UUID encompassingAlertId=null;
  if (hasDependencies) {
    for (    Check<?,?> dependency : check.getDepends()) {
      CheckState dependencyState=dependency.getState();
      dependenciesAreAllHard&=dependencyState.isHard();
      dependenciesAreAllOk&=dependencyState.isHardOk();
      if (dependencyState.isHardNotOk() && encompassingAlertId == null)       encompassingAlertId=dependencyState.getCurrentAlertId();
    }
    logger.debug("String_Node_Str" + check.getId() + "String_Node_Str"+ dependenciesAreAllHard+ "String_Node_Str"+ dependenciesAreAllOk);
  }
  CheckState nextState=currentState.clone();
  nextState.setOk(resultMO.isOk());
  nextState.pushOkHistory(resultMO.isOk());
  nextState.setStatus(resultStatus);
  nextState.setOutput(resultMO.getOutput());
  nextState.setLastCheckTime(new Timestamp(resultMO.getExecuted()));
  nextState.setInDowntime(check.isInDowntime());
  nextState.setSuppressed(check.isSuppressed());
  if (currentState.getCurrentAlertId() != null) {
    Alert currentAlert=currentState.getCurrentAlert();
    currentState.setAcknowledged(currentAlert == null ? false : currentAlert.isAcknowledged());
  }
  nextState.setEncompassed(dependenciesAreAllHard && (!dependenciesAreAllOk));
  if (currentState.isOk() ^ nextState.isOk()) {
    if (currentState.isHard()) {
      nextState.setLastHardOk(currentState.isOk());
      nextState.setLastHardStatus(currentState.getStatus());
      nextState.setLastHardOutput(currentState.getOutput());
    }
    nextState.setLastStateChange(new Timestamp(System.currentTimeMillis()));
    if (check.computeCurrentAttemptThreshold(nextState) <= 1 && ((!hasDependencies) || dependenciesAreAllHard)) {
      nextState.setHard(true);
      nextState.setTransitioning(false);
      nextState.setAttempt(check.computeCurrentAttemptThreshold(nextState));
      if (nextState.isAlert()) {
        nextState.setCurrentAlertId(encompassingAlertId == null ? Site.randomId(check.getSiteId()) : encompassingAlertId);
        nextState.setAcknowledged(false);
      }
      if (nextState.isRecovery()) {
        nextState.setCurrentAlertId(null);
        nextState.setAcknowledged(false);
      }
      return new Transition().previousState(currentState).nextState(nextState).stateChange(true).hardChange(true).alert(nextState.isAlert()).recovery(nextState.isRecovery());
    }
 else {
      nextState.setHard(false);
      nextState.setTransitioning(true);
      nextState.setAttempt(1);
      return new Transition().previousState(currentState).nextState(nextState).stateChange(true).hardChange(false).alert(false).recovery(false);
    }
  }
 else   if (currentState.isHard()) {
    return new Transition().previousState(currentState).nextState(nextState).stateChange(false).hardChange(false).alert(false).recovery(false);
  }
 else {
    nextState.setAttempt(currentState.getAttempt() + 1);
    if (nextState.getAttempt() >= check.computeCurrentAttemptThreshold(nextState) && ((!hasDependencies) || dependenciesAreAllHard)) {
      nextState.setHard(true);
      nextState.setTransitioning(false);
      nextState.setAttempt(check.computeCurrentAttemptThreshold(nextState));
      if (nextState.isAlert()) {
        nextState.setCurrentAlertId(encompassingAlertId == null ? Site.randomId(check.getSiteId()) : encompassingAlertId);
        nextState.setAcknowledged(false);
      }
      if (nextState.isRecovery()) {
        nextState.setCurrentAlertId(null);
        nextState.setAcknowledged(false);
      }
      return new Transition().previousState(currentState).nextState(nextState).stateChange(false).hardChange(true).alert(nextState.isAlert()).recovery(nextState.isRecovery());
    }
 else {
      return new Transition().previousState(currentState).nextState(nextState).stateChange(false).hardChange(false).alert(false).recovery(false);
    }
  }
}