Program: 157037
Project: 157037
Buggy source:
@Override public final void run(){
  if (!check.isEnabled()) {
    return;
  }
  try {
    Map<String,Optional<BigDecimal>> targetValues=targetChecker.check(check);
    if (targetValues.isEmpty()) {
      return;
    }
    DateTime now=new DateTime();
    BigDecimal warn=check.getWarn();
    BigDecimal error=check.getError();
    AlertType worstState=AlertType.UNKNOWN;
    List<Alert> interestingAlerts=new ArrayList<Alert>();
    for (    Entry<String,Optional<BigDecimal>> entry : targetValues.entrySet()) {
      String target=entry.getKey();
      Optional<BigDecimal> value=entry.getValue();
      if (!value.isPresent()) {
        LOGGER.warn("String_Node_Str",target);
        continue;
      }
      BigDecimal currentValue=value.get();
      Alert lastAlert=alertsStore.getLastAlertForTarget(target);
      AlertType lastState;
      if (lastAlert == null) {
        lastState=AlertType.OK;
      }
 else {
        lastState=lastAlert.getToType();
      }
      AlertType currentState=valueChecker.checkValue(currentValue,warn,error);
      if (currentState.isWorseThan(worstState)) {
        worstState=currentState;
      }
      if (isStillOk(lastState,currentState)) {
        continue;
      }
      Alert alert=createAlert(target,currentValue,warn,error,lastState,currentState,now);
      alertsStore.createAlert(check.getId(),alert);
      if (stateIsTheSame(lastState,currentState)) {
        continue;
      }
      interestingAlerts.add(alert);
    }
    check.setState(worstState);
    checksStore.saveCheck(check);
    if (interestingAlerts.isEmpty()) {
      return;
    }
    for (    Subscription subscription : check.getSubscriptions()) {
      if (!subscription.shouldNotify(now)) {
        continue;
      }
      for (      NotificationService notificationService : notificationServices) {
        if (notificationService.canHandle(subscription.getType())) {
          try {
            notificationService.sendNotification(check,subscription,interestingAlerts);
          }
 catch (          Exception e) {
            LOGGER.warn("String_Node_Str" + subscription.getTarget() + "String_Node_Str"+ subscription.getType()+ "String_Node_Str",e);
          }
        }
      }
    }
  }
 catch (  Exception e) {
    LOGGER.warn(check.getName() + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public final void run(){
  if (!check.isEnabled()) {
    return;
  }
  try {
    Map<String,Optional<BigDecimal>> targetValues=targetChecker.check(check);
    if (targetValues.isEmpty()) {
      return;
    }
    DateTime now=new DateTime();
    BigDecimal warn=check.getWarn();
    BigDecimal error=check.getError();
    AlertType worstState=AlertType.UNKNOWN;
    List<Alert> interestingAlerts=new ArrayList<Alert>();
    for (    Entry<String,Optional<BigDecimal>> entry : targetValues.entrySet()) {
      String target=entry.getKey();
      Optional<BigDecimal> value=entry.getValue();
      if (!value.isPresent()) {
        LOGGER.warn("String_Node_Str",target);
        continue;
      }
      BigDecimal currentValue=value.get();
      Alert lastAlert=alertsStore.getLastAlertForTargetOfCheck(target,check.getId());
      AlertType lastState;
      if (lastAlert == null) {
        lastState=AlertType.OK;
      }
 else {
        lastState=lastAlert.getToType();
      }
      AlertType currentState=valueChecker.checkValue(currentValue,warn,error);
      if (currentState.isWorseThan(worstState)) {
        worstState=currentState;
      }
      if (isStillOk(lastState,currentState)) {
        continue;
      }
      Alert alert=createAlert(target,currentValue,warn,error,lastState,currentState,now);
      alertsStore.createAlert(check.getId(),alert);
      if (stateIsTheSame(lastState,currentState)) {
        continue;
      }
      interestingAlerts.add(alert);
    }
    check.setState(worstState);
    checksStore.saveCheck(check);
    if (interestingAlerts.isEmpty()) {
      return;
    }
    for (    Subscription subscription : check.getSubscriptions()) {
      if (!subscription.shouldNotify(now)) {
        continue;
      }
      for (      NotificationService notificationService : notificationServices) {
        if (notificationService.canHandle(subscription.getType())) {
          try {
            notificationService.sendNotification(check,subscription,interestingAlerts);
          }
 catch (          Exception e) {
            LOGGER.warn("String_Node_Str" + subscription.getTarget() + "String_Node_Str"+ subscription.getType()+ "String_Node_Str",e);
          }
        }
      }
    }
  }
 catch (  Exception e) {
    LOGGER.warn(check.getName() + "String_Node_Str",e);
  }
}