Program: 34435
Project: 34435
Buggy source:
private void resyncFrameworksWithLiveApplications(Map<String,ApplicationReport> liveApplicationReports) throws Exception {
  String logScope="String_Node_Str";
  CHANGE_AWARE_LOGGER.initializeScope(logScope,Level.INFO);
  CHANGE_AWARE_LOGGER.log(logScope,"String_Node_Str",liveApplicationReports.size());
  for (  ApplicationReport applicationReport : liveApplicationReports.values()) {
    String applicationId=applicationReport.getApplicationId().toString();
    YarnApplicationState applicationState=applicationReport.getYarnApplicationState();
    FinalApplicationStatus applicationFinalStatus=applicationReport.getFinalApplicationStatus();
    String diagnostics=applicationReport.getDiagnostics();
    if (statusManager.isApplicationIdLiveAssociated(applicationId)) {
      FrameworkStatus frameworkStatus=statusManager.getFrameworkStatusWithLiveAssociatedApplicationId(applicationId);
      String frameworkName=frameworkStatus.getFrameworkName();
      FrameworkState frameworkState=frameworkStatus.getFrameworkState();
      if (frameworkState == FrameworkState.APPLICATION_CREATED) {
        return;
      }
      statusManager.updateApplicationStatus(frameworkName,applicationReport);
      if (applicationFinalStatus == FinalApplicationStatus.UNDEFINED) {
        if (applicationState == YarnApplicationState.NEW || applicationState == YarnApplicationState.NEW_SAVING || applicationState == YarnApplicationState.SUBMITTED || applicationState == YarnApplicationState.ACCEPTED) {
          statusManager.transitionFrameworkState(frameworkName,FrameworkState.APPLICATION_WAITING);
        }
 else         if (applicationState == YarnApplicationState.RUNNING) {
          statusManager.transitionFrameworkState(frameworkName,FrameworkState.APPLICATION_RUNNING);
        }
      }
 else       if (applicationFinalStatus == FinalApplicationStatus.SUCCEEDED) {
        retrieveApplicationDiagnostics(applicationId,ExitStatusKey.SUCCEEDED.toInt(),diagnostics,false);
      }
 else       if (applicationFinalStatus == FinalApplicationStatus.KILLED) {
        retrieveApplicationDiagnostics(applicationId,ExitStatusKey.AM_KILLED_BY_USER.toInt(),diagnostics,false);
      }
 else       if (applicationFinalStatus == FinalApplicationStatus.FAILED) {
        retrieveApplicationDiagnostics(applicationId,null,diagnostics,false);
      }
    }
 else {
    }
  }
  List<String> liveAssociatedApplicationIds=statusManager.getLiveAssociatedApplicationIds();
  for (  String applicationId : liveAssociatedApplicationIds) {
    if (!liveApplicationReports.containsKey(applicationId)) {
      FrameworkStatus frameworkStatus=statusManager.getFrameworkStatusWithLiveAssociatedApplicationId(applicationId);
      String frameworkName=frameworkStatus.getFrameworkName();
      FrameworkState frameworkState=frameworkStatus.getFrameworkState();
      if (frameworkState == FrameworkState.APPLICATION_CREATED) {
        return;
      }
      LOGGER.logWarning("String_Node_Str" + "String_Node_Str",frameworkName,applicationId);
      retrieveApplicationDiagnostics(applicationId,ExitStatusKey.AM_RM_RESYNC_LOST.toInt(),"String_Node_Str",false);
    }
  }
}

Fixed version (ground truth):
private void resyncFrameworksWithLiveApplications(Map<String,ApplicationReport> liveApplicationReports) throws Exception {
  String logScope="String_Node_Str";
  CHANGE_AWARE_LOGGER.initializeScope(logScope,Level.INFO);
  CHANGE_AWARE_LOGGER.log(logScope,"String_Node_Str",liveApplicationReports.size());
  for (  ApplicationReport applicationReport : liveApplicationReports.values()) {
    String applicationId=applicationReport.getApplicationId().toString();
    YarnApplicationState applicationState=applicationReport.getYarnApplicationState();
    FinalApplicationStatus applicationFinalStatus=applicationReport.getFinalApplicationStatus();
    String diagnostics=applicationReport.getDiagnostics();
    if (statusManager.isApplicationIdLiveAssociated(applicationId)) {
      FrameworkStatus frameworkStatus=statusManager.getFrameworkStatusWithLiveAssociatedApplicationId(applicationId);
      String frameworkName=frameworkStatus.getFrameworkName();
      FrameworkState frameworkState=frameworkStatus.getFrameworkState();
      if (frameworkState == FrameworkState.APPLICATION_CREATED) {
        continue;
      }
      statusManager.updateApplicationStatus(frameworkName,applicationReport);
      if (applicationFinalStatus == FinalApplicationStatus.UNDEFINED) {
        if (applicationState == YarnApplicationState.NEW || applicationState == YarnApplicationState.NEW_SAVING || applicationState == YarnApplicationState.SUBMITTED || applicationState == YarnApplicationState.ACCEPTED) {
          statusManager.transitionFrameworkState(frameworkName,FrameworkState.APPLICATION_WAITING);
        }
 else         if (applicationState == YarnApplicationState.RUNNING) {
          statusManager.transitionFrameworkState(frameworkName,FrameworkState.APPLICATION_RUNNING);
        }
      }
 else       if (applicationFinalStatus == FinalApplicationStatus.SUCCEEDED) {
        retrieveApplicationDiagnostics(applicationId,ExitStatusKey.SUCCEEDED.toInt(),diagnostics,false);
      }
 else       if (applicationFinalStatus == FinalApplicationStatus.KILLED) {
        retrieveApplicationDiagnostics(applicationId,ExitStatusKey.AM_KILLED_BY_USER.toInt(),diagnostics,false);
      }
 else       if (applicationFinalStatus == FinalApplicationStatus.FAILED) {
        retrieveApplicationDiagnostics(applicationId,null,diagnostics,false);
      }
    }
 else {
    }
  }
  List<String> liveAssociatedApplicationIds=statusManager.getLiveAssociatedApplicationIds();
  for (  String applicationId : liveAssociatedApplicationIds) {
    if (!liveApplicationReports.containsKey(applicationId)) {
      FrameworkStatus frameworkStatus=statusManager.getFrameworkStatusWithLiveAssociatedApplicationId(applicationId);
      String frameworkName=frameworkStatus.getFrameworkName();
      FrameworkState frameworkState=frameworkStatus.getFrameworkState();
      if (frameworkState == FrameworkState.APPLICATION_CREATED) {
        continue;
      }
      LOGGER.logWarning("String_Node_Str" + "String_Node_Str",frameworkName,applicationId);
      retrieveApplicationDiagnostics(applicationId,ExitStatusKey.AM_RM_RESYNC_LOST.toInt(),"String_Node_Str",false);
    }
  }
}