Program: 59021
Project: 59021
Buggy source:
public void runReimbursementExportProcess(Company company){
  int i=0;
  List<Reimbursement> reimbursementToCancelList=Reimbursement.filter("String_Node_Str",company).fetch();
  Status statusCan=Status.findByCode("String_Node_Str");
  for (  Reimbursement reimbursement : reimbursementToCancelList) {
    reimbursement.setStatus(statusCan);
  }
  List<Reimbursement> reimbursementList=Reimbursement.filter("String_Node_Str",company).fetch();
  List<Reimbursement> reimbursementToExport=new ArrayList<Reimbursement>();
  for (  Reimbursement reimbursement : reimbursementList) {
    try {
      reimbursement=Reimbursement.find(reimbursement.getId());
      if (reimbursementExportService.canBeReimbursed(reimbursement.getPartner(),reimbursement.getCompany())) {
        reimbursementExportService.reimburse(reimbursement,company);
        updateReimbursement(Reimbursement.find(reimbursement.getId()));
        reimbursementToExport.add(reimbursement);
        this.totalAmount=this.totalAmount.add(Reimbursement.find(reimbursement.getId()).getAmountReimbursed());
        i++;
      }
    }
 catch (    AxelorException e) {
      TraceBackService.trace(new AxelorException(String.format("String_Node_Str",Reimbursement.find(reimbursement.getId()).getRef()),e,e.getcategory()),IException.REIMBURSEMENT,batch.getId());
      incrementAnomaly();
    }
catch (    Exception e) {
      TraceBackService.trace(new Exception(String.format("String_Node_Str",Reimbursement.find(reimbursement.getId()).getRef()),e),IException.REIMBURSEMENT,batch.getId());
      incrementAnomaly();
      LOG.error("String_Node_Str",Reimbursement.find(reimbursement.getId()).getRef());
    }
 finally {
      if (i % 10 == 0) {
        JPA.clear();
      }
    }
  }
  if (reimbursementToExport != null && reimbursementToExport.size() != 0) {
    try {
      reimbursementExportService.exportSepa(Company.find(company.getId()),Batch.find(batch.getId()).getStartDate(),reimbursementToExport,Batch.find(batch.getId()).getAccountingBatch().getBankDetails());
    }
 catch (    Exception e) {
      TraceBackService.trace(new Exception(String.format("String_Node_Str",batch.getId()),e),IException.REIMBURSEMENT,batch.getId());
      incrementAnomaly();
      LOG.error("String_Node_Str",batch.getId());
    }
    try {
      cfonbExportService.exportCFONB(Company.find(company.getId()),Batch.find(batch.getId()).getStartDate(),reimbursementToExport,Batch.find(batch.getId()).getAccountingBatch().getBankDetails());
    }
 catch (    Exception e) {
      TraceBackService.trace(new Exception(String.format("String_Node_Str",batch.getId()),e),IException.REIMBURSEMENT,batch.getId());
      incrementAnomaly();
      LOG.error("String_Node_Str",batch.getId());
    }
  }
}

Fixed version (ground truth):
public void runReimbursementExportProcess(Company company){
  int i=0;
  List<Reimbursement> reimbursementToCancelList=(List<Reimbursement>)Reimbursement.filter("String_Node_Str",company).fetch();
  Status statusCan=Status.findByCode("String_Node_Str");
  for (  Reimbursement reimbursement : reimbursementToCancelList) {
    reimbursement.setStatus(statusCan);
  }
  List<Reimbursement> reimbursementList=(List<Reimbursement>)Reimbursement.filter("String_Node_Str",company).fetch();
  List<Reimbursement> reimbursementToExport=new ArrayList<Reimbursement>();
  for (  Reimbursement reimbursement : reimbursementList) {
    try {
      reimbursement=Reimbursement.find(reimbursement.getId());
      if (reimbursementExportService.canBeReimbursed(reimbursement.getPartner(),reimbursement.getCompany())) {
        reimbursementExportService.reimburse(reimbursement,company);
        updateReimbursement(Reimbursement.find(reimbursement.getId()));
        reimbursementToExport.add(reimbursement);
        this.totalAmount=this.totalAmount.add(Reimbursement.find(reimbursement.getId()).getAmountReimbursed());
        i++;
      }
    }
 catch (    AxelorException e) {
      TraceBackService.trace(new AxelorException(String.format("String_Node_Str",Reimbursement.find(reimbursement.getId()).getRef()),e,e.getcategory()),IException.REIMBURSEMENT,batch.getId());
      incrementAnomaly();
    }
catch (    Exception e) {
      TraceBackService.trace(new Exception(String.format("String_Node_Str",Reimbursement.find(reimbursement.getId()).getRef()),e),IException.REIMBURSEMENT,batch.getId());
      incrementAnomaly();
      LOG.error("String_Node_Str",Reimbursement.find(reimbursement.getId()).getRef());
    }
 finally {
      if (i % 10 == 0) {
        JPA.clear();
      }
    }
  }
  if (reimbursementToExport != null && reimbursementToExport.size() != 0) {
    try {
      reimbursementExportService.exportSepa(Company.find(company.getId()),Batch.find(batch.getId()).getStartDate(),reimbursementToExport,Batch.find(batch.getId()).getAccountingBatch().getBankDetails());
    }
 catch (    Exception e) {
      TraceBackService.trace(new Exception(String.format("String_Node_Str",batch.getId()),e),IException.REIMBURSEMENT,batch.getId());
      incrementAnomaly();
      LOG.error("String_Node_Str",batch.getId());
    }
    try {
      cfonbExportService.exportCFONB(Company.find(company.getId()),Batch.find(batch.getId()).getStartDate(),reimbursementToExport,Batch.find(batch.getId()).getAccountingBatch().getBankDetails());
    }
 catch (    Exception e) {
      TraceBackService.trace(new Exception(String.format("String_Node_Str",batch.getId()),e),IException.REIMBURSEMENT,batch.getId());
      incrementAnomaly();
      LOG.error("String_Node_Str",batch.getId());
    }
  }
}