Program: 58662
Project: 58662
Buggy source:
/** 
 * Method to create a recipient record for international transfer AFB320
 * @param company
 * @param dateTime
 * @return
 * @throws AxelorException
 */
protected String createDetailRecord(BankOrderLine bankOrderLine) throws AxelorException {
  try {
    String detailRecord=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",sequence++,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,6);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getReceiverBankDetails().getIban(),cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,34);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getPartner().getFullName(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,35);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,3 * 35);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,17);
    Country receiverCountry=bankOrderLine.getReceiverCountry();
    String countryCode="String_Node_Str";
    if (receiverCountry != null) {
      countryCode=receiverCountry.getAlpha2Code();
    }
    detailRecord+=cfonbToolService.createZone("String_Node_Str",countryCode,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getSequence(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,16);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,4);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getBankOrderAmount(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,14);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,1);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    BankOrderEconomicReason bankOrderEconomicReason=bankOrderLine.getBankOrderEconomicReason();
    String bankOrderEconomicReasonCode="String_Node_Str";
    if (bankOrderEconomicReason != null) {
      bankOrderEconomicReasonCode=bankOrderEconomicReason.getCode();
    }
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderEconomicReasonCode,cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getPaymentModeSelect(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getFeesImputationModeSelect(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,57);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",paymentMode.getBankOrderFileFormat().getQualifyingOfDate(),cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    if (isMultiDates) {
      String bankOrderDate="String_Node_Str";
      if (bankOrderLine.getBankOrderDate() != null) {
        bankOrderDate=bankOrderLine.getBankOrderDate().toString("String_Node_Str");
      }
      detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderDate,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,8);
    }
 else {
      detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_NUMERIC,8);
    }
    if (isMultiCurrencies) {
      String bankOrderCurrencyCode="String_Node_Str";
      if (bankOrderLine.getBankOrderCurrency() != null) {
        bankOrderCurrencyCode=bankOrderLine.getBankOrderCurrency().getCode();
      }
      detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderCurrencyCode,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    }
 else {
      detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    }
    cfonbToolService.toUpperCase(detailRecord);
    cfonbToolService.testLength(detailRecord,NB_CHAR_PER_LINE);
    return detailRecord;
  }
 catch (  AxelorException e) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.BANK_ORDER_WRONG_MAIN_DETAIL_RECORD),bankOrderLine.getSequence()),e,IException.MISSING_FIELD);
  }
}

Fixed version (ground truth):
/** 
 * Method to create a recipient record for international transfer AFB320
 * @param company
 * @param dateTime
 * @return
 * @throws AxelorException
 */
protected String createDetailRecord(BankOrderLine bankOrderLine) throws AxelorException {
  try {
    String detailRecord=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",sequence++,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,6);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getReceiverBankDetails().getIban(),cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,34);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getPartner().getFullName(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,35);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,3 * 35);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,17);
    Country receiverCountry=bankOrderLine.getReceiverCountry();
    String countryCode="String_Node_Str";
    if (receiverCountry != null) {
      countryCode=receiverCountry.getAlpha2Code();
    }
    detailRecord+=cfonbToolService.createZone("String_Node_Str",countryCode,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getSequence(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,16);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,4);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getBankOrderAmount(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,14);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,1);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    BankOrderEconomicReason bankOrderEconomicReason=bankOrderLine.getBankOrderEconomicReason();
    String bankOrderEconomicReasonCode="String_Node_Str";
    if (bankOrderEconomicReason != null) {
      bankOrderEconomicReasonCode=bankOrderEconomicReason.getCode();
    }
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderEconomicReasonCode,cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getPaymentModeSelect(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderLine.getFeesImputationModeSelect(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,2);
    detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,57);
    detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderFileFormat.getQualifyingOfDate(),cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    if (isMultiDates) {
      String bankOrderDate="String_Node_Str";
      if (bankOrderLine.getBankOrderDate() != null) {
        bankOrderDate=bankOrderLine.getBankOrderDate().toString("String_Node_Str");
      }
      detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderDate,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,8);
    }
 else {
      detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_NUMERIC,8);
    }
    if (isMultiCurrencies) {
      String bankOrderCurrencyCode="String_Node_Str";
      if (bankOrderLine.getBankOrderCurrency() != null) {
        bankOrderCurrencyCode=bankOrderLine.getBankOrderCurrency().getCode();
      }
      detailRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderCurrencyCode,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    }
 else {
      detailRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    }
    cfonbToolService.toUpperCase(detailRecord);
    cfonbToolService.testLength(detailRecord,NB_CHAR_PER_LINE);
    return detailRecord;
  }
 catch (  AxelorException e) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.BANK_ORDER_WRONG_MAIN_DETAIL_RECORD),bankOrderLine.getSequence()),e,IException.MISSING_FIELD);
  }
}