Program: 59005
Project: 59005
Buggy source:
/** 
 * Méthode réalisant l'export SI - Agresso des en-têtes pour les journaux de type avoir
 * @param mlr
 * @param replay
 * @throws AxelorException
 * @throws IOException 
 */
@SuppressWarnings("String_Node_Str") @Transactional(rollbackOn={AxelorException.class,Exception.class}) public void exportMoveLineTypeSelect7FILE1(MoveLineReport moveLineReport,boolean replay) throws AxelorException, IOException {
  LOG.info("String_Node_Str");
  Company company=moveLineReport.getCompany();
  String dateQueryStr=String.format("String_Node_Str",company.getId());
  JournalType journalType=moveLineReportService.getJournalType(moveLineReport);
  if (moveLineReport.getJournal() != null) {
    dateQueryStr+=String.format("String_Node_Str",moveLineReport.getJournal().getId());
  }
 else {
    dateQueryStr+=String.format("String_Node_Str",journalType.getId());
  }
  if (moveLineReport.getPeriod() != null) {
    dateQueryStr+=String.format("String_Node_Str",moveLineReport.getPeriod().getId());
  }
  if (replay) {
    dateQueryStr+=String.format("String_Node_Str",moveLineReport.getId());
  }
 else {
    dateQueryStr+="String_Node_Str";
  }
  dateQueryStr+="String_Node_Str";
  Query dateQuery=JPA.em().createQuery("String_Node_Str" + dateQueryStr + "String_Node_Str");
  List<LocalDate> allDates=new ArrayList<LocalDate>();
  allDates=dateQuery.getResultList();
  LOG.debug("String_Node_Str",allDates);
  List<String[]> allMoveData=new ArrayList<String[]>();
  String companyCode="String_Node_Str";
  String reference="String_Node_Str";
  String moveQueryStr="String_Node_Str";
  String moveLineQueryStr="String_Node_Str";
  if (moveLineReport.getRef() != null) {
    reference=moveLineReport.getRef();
  }
  if (moveLineReport.getCompany() != null) {
    companyCode=moveLineReport.getCompany().getCode();
    moveQueryStr+=String.format("String_Node_Str",moveLineReport.getCompany().getId());
  }
  if (moveLineReport.getPeriod() != null) {
    moveQueryStr+=String.format("String_Node_Str",moveLineReport.getPeriod().getId());
  }
  if (moveLineReport.getDateFrom() != null) {
    moveLineQueryStr+=String.format("String_Node_Str",moveLineReport.getDateFrom().toString());
  }
  if (moveLineReport.getDateTo() != null) {
    moveLineQueryStr+=String.format("String_Node_Str",moveLineReport.getDateTo().toString());
  }
  if (moveLineReport.getDate() != null) {
    moveLineQueryStr+=String.format("String_Node_Str",moveLineReport.getDate().toString());
  }
  if (replay) {
    moveQueryStr+=String.format("String_Node_Str",moveLineReport.getId());
  }
 else {
    moveQueryStr+="String_Node_Str";
  }
  LocalDate interfaceDate=moveLineReport.getDate();
  for (  LocalDate dt : allDates) {
    List<? extends Journal> journalList=Journal.filter("String_Node_Str",journalType).fetch();
    if (moveLineReport.getJournal() != null) {
      journalList=new ArrayList<Journal>();
      journalList.add(moveLineReport.getJournal());
    }
    for (    Journal journal : journalList) {
      List<Move> moveList=Move.filter("String_Node_Str" + moveQueryStr,dt,journal).fetch();
      String journalCode=journal.getExportCode();
      if (moveList.size() > 0) {
        BigDecimal sumCredit=this.getSumCredit("String_Node_Str" + moveLineQueryStr,moveList);
        if (sumCredit.compareTo(BigDecimal.ZERO) == 1) {
          String exportNumber=this.getSaleExportNumber(company);
          Move firstMove=moveList.get(0);
          String periodCode=firstMove.getPeriod().getFromDate().toString("String_Node_Str");
          this.updateMoveList(moveList,moveLineReport,interfaceDate,exportNumber);
          String items[]=new String[8];
          items[0]=companyCode;
          items[1]=journalCode;
          items[2]=exportNumber;
          items[3]=interfaceDate.toString("String_Node_Str");
          items[4]=sumCredit.toString();
          items[5]=reference;
          items[6]=dt.toString("String_Node_Str");
          items[7]=periodCode;
          allMoveData.add(items);
        }
      }
    }
  }
  String fileName="String_Node_Str" + todayTime.toString("String_Node_Str") + "String_Node_Str";
  String filePath=accountConfigService.getExportPath(accountConfigService.getAccountConfig(company));
  new File(filePath).mkdirs();
  LOG.debug("String_Node_Str",filePath,fileName);
  CsvTool.csvWriter(filePath,fileName,'|',null,allMoveData);
}

Fixed version (ground truth):
/** 
 * Méthode réalisant l'export SI - Agresso des en-têtes pour les journaux de type avoir
 * @param mlr
 * @param replay
 * @throws AxelorException
 * @throws IOException 
 */
@SuppressWarnings("String_Node_Str") @Transactional(rollbackOn={AxelorException.class,Exception.class}) public void exportMoveLineTypeSelect7FILE1(MoveLineReport moveLineReport,boolean replay) throws AxelorException, IOException {
  LOG.info("String_Node_Str");
  Company company=moveLineReport.getCompany();
  String dateQueryStr=String.format("String_Node_Str",company.getId());
  JournalType journalType=moveLineReportService.getJournalType(moveLineReport);
  if (moveLineReport.getJournal() != null) {
    dateQueryStr+=String.format("String_Node_Str",moveLineReport.getJournal().getId());
  }
 else {
    dateQueryStr+=String.format("String_Node_Str",journalType.getId());
  }
  if (moveLineReport.getPeriod() != null) {
    dateQueryStr+=String.format("String_Node_Str",moveLineReport.getPeriod().getId());
  }
  if (replay) {
    dateQueryStr+=String.format("String_Node_Str",moveLineReport.getId());
  }
 else {
    dateQueryStr+="String_Node_Str";
  }
  dateQueryStr+="String_Node_Str";
  Query dateQuery=JPA.em().createQuery("String_Node_Str" + dateQueryStr + "String_Node_Str");
  List<LocalDate> allDates=new ArrayList<LocalDate>();
  allDates=dateQuery.getResultList();
  LOG.debug("String_Node_Str",allDates);
  List<String[]> allMoveData=new ArrayList<String[]>();
  String companyCode="String_Node_Str";
  String reference="String_Node_Str";
  String moveQueryStr="String_Node_Str";
  String moveLineQueryStr="String_Node_Str";
  if (moveLineReport.getRef() != null) {
    reference=moveLineReport.getRef();
  }
  if (moveLineReport.getCompany() != null) {
    companyCode=moveLineReport.getCompany().getCode();
    moveQueryStr+=String.format("String_Node_Str",moveLineReport.getCompany().getId());
  }
  if (moveLineReport.getPeriod() != null) {
    moveQueryStr+=String.format("String_Node_Str",moveLineReport.getPeriod().getId());
  }
  if (moveLineReport.getDateFrom() != null) {
    moveLineQueryStr+=String.format("String_Node_Str",moveLineReport.getDateFrom().toString());
  }
  if (moveLineReport.getDateTo() != null) {
    moveLineQueryStr+=String.format("String_Node_Str",moveLineReport.getDateTo().toString());
  }
  if (moveLineReport.getDate() != null) {
    moveLineQueryStr+=String.format("String_Node_Str",moveLineReport.getDate().toString());
  }
  if (replay) {
    moveQueryStr+=String.format("String_Node_Str",moveLineReport.getId());
  }
 else {
    moveQueryStr+="String_Node_Str";
  }
  LocalDate interfaceDate=moveLineReport.getDate();
  for (  LocalDate dt : allDates) {
    List<Journal> journalList=(List<Journal>)Journal.filter("String_Node_Str",journalType).fetch();
    if (moveLineReport.getJournal() != null) {
      journalList=new ArrayList<Journal>();
      journalList.add(moveLineReport.getJournal());
    }
    for (    Journal journal : journalList) {
      List<Move> moveList=(List<Move>)Move.filter("String_Node_Str" + moveQueryStr,dt,journal).fetch();
      String journalCode=journal.getExportCode();
      if (moveList.size() > 0) {
        BigDecimal sumCredit=this.getSumCredit("String_Node_Str" + moveLineQueryStr,moveList);
        if (sumCredit.compareTo(BigDecimal.ZERO) == 1) {
          String exportNumber=this.getSaleExportNumber(company);
          Move firstMove=moveList.get(0);
          String periodCode=firstMove.getPeriod().getFromDate().toString("String_Node_Str");
          this.updateMoveList(moveList,moveLineReport,interfaceDate,exportNumber);
          String items[]=new String[8];
          items[0]=companyCode;
          items[1]=journalCode;
          items[2]=exportNumber;
          items[3]=interfaceDate.toString("String_Node_Str");
          items[4]=sumCredit.toString();
          items[5]=reference;
          items[6]=dt.toString("String_Node_Str");
          items[7]=periodCode;
          allMoveData.add(items);
        }
      }
    }
  }
  String fileName="String_Node_Str" + todayTime.toString("String_Node_Str") + "String_Node_Str";
  String filePath=accountConfigService.getExportPath(accountConfigService.getAccountConfig(company));
  new File(filePath).mkdirs();
  LOG.debug("String_Node_Str",filePath,fileName);
  CsvTool.csvWriter(filePath,fileName,'|',null,allMoveData);
}