Program: 173807
Project: 173807
Buggy source:
private void resetOperatingCompanies(List<PublicCompanyI> mergingCompanies){
  List<PublicCompanyI> companies=new ArrayList<PublicCompanyI>(Arrays.asList(operatingCompanyArray));
  PublicCompanyI cgr=companyManager.getCompanyByName(PublicCompany_CGR.NAME);
  boolean cgrCanOperate=cgr.hasStarted();
  for (  PublicCompanyI company : mergingCompanies) {
    if (companiesOperatedThisRound.contains(company))     cgrCanOperate=false;
  }
  while (setNextOperatingCompany(false) && operatingCompany.isClosed())   ;
  if (operatingCompany != null) {
    operatingCompanyIndex=companies.indexOf(operatingCompany);
  }
  for (  PublicCompanyI c : companies) {
    if (c.isClosed()) {
      log.info(c.getName() + "String_Node_Str");
    }
 else {
      log.debug(c.getName() + "String_Node_Str");
    }
  }
  String message;
  if (cgr.hasStarted()) {
    if (cgrCanOperate) {
      operatingCompanyIndex=Math.max(0,operatingCompanyIndex);
      companies.add(operatingCompanyIndex,cgr);
      operatingCompany=cgr;
      operatingCompanyIndex=companies.indexOf(operatingCompany);
      message=LocalText.getText("String_Node_Str",cgr.getName());
    }
 else {
      message=LocalText.getText("String_Node_Str",cgr.getName());
    }
  }
 else {
    message=LocalText.getText("String_Node_Str",cgr.getName());
  }
  ReportBuffer.add(message);
  DisplayBuffer.add(message);
  operatingCompanyArray=companies.toArray(new PublicCompanyI[0]);
  operatingCompanyIndexObject.set(operatingCompanyIndex);
  log.debug("String_Node_Str" + operatingCompany.getName());
}

Fixed version (ground truth):
private void resetOperatingCompanies(List<PublicCompanyI> mergingCompanies){
  List<PublicCompanyI> companies=new ArrayList<PublicCompanyI>(Arrays.asList(operatingCompanyArray));
  PublicCompanyI cgr=companyManager.getCompanyByName(PublicCompany_CGR.NAME);
  boolean cgrCanOperate=cgr.hasStarted();
  for (  PublicCompanyI company : mergingCompanies) {
    if (companiesOperatedThisRound.contains(company))     cgrCanOperate=false;
  }
  while (setNextOperatingCompany(false) && operatingCompany.isClosed())   ;
  for (  PublicCompanyI c : companies) {
    if (c.isClosed()) {
      log.info(c.getName() + "String_Node_Str");
    }
 else {
      log.debug(c.getName() + "String_Node_Str");
    }
  }
  String message;
  if (cgr.hasStarted()) {
    if (cgrCanOperate) {
      operatingCompanyIndex=Math.max(0,operatingCompanyIndex);
      companies.add(operatingCompanyIndex,cgr);
      operatingCompany=cgr;
      operatingCompanyIndex=companies.indexOf(operatingCompany);
      message=LocalText.getText("String_Node_Str",cgr.getName());
    }
 else {
      message=LocalText.getText("String_Node_Str",cgr.getName());
      while (setNextOperatingCompany(false) && operatingCompany.isClosed())       ;
    }
  }
 else {
    message=LocalText.getText("String_Node_Str",cgr.getName());
  }
  ReportBuffer.add(message);
  DisplayBuffer.add(message);
  operatingCompanyArray=companies.toArray(new PublicCompanyI[0]);
  if (operatingCompanyIndex < operatingCompanyArray.length) {
    operatingCompanyIndexObject.set(operatingCompanyIndex);
    log.debug("String_Node_Str" + operatingCompany.getName());
  }
 else {
    finishOR();
  }
}