Program: 58661
Project: 58661
Buggy source:
/** 
 * Method to create a sender record for international transfer AFB320
 * @param company
 * @param dateTime
 * @return
 * @throws AxelorException
 */
protected String createSenderRecord() throws AxelorException {
  try {
    String senderRecord=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,2);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,2);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",sequence++,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,6);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",this.validationDateTime.toString("String_Node_Str"),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,8);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderCompany.getName(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,35);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderCompany.getName(),cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,3 * 35);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",registrationCode,cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,14);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderSeq,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,16);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,11);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,1);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderBankDetails.getIban(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,34);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderCompany.getCurrency().getCode(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,16);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderBankDetails.getIban(),cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,34);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderCompany.getCurrency().getCode(),cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,4);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",paymentMode.getBankOrderFileFormat().getQualifyingOfDate(),cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,8);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",this.getOrderIndexType(isMultiDates,isMultiCurrencies),cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    if (!isMultiDates) {
      senderRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderDate.toString("String_Node_Str"),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,8);
    }
 else {
      senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_NUMERIC,8);
    }
    if (!isMultiCurrencies) {
      senderRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderCurrency.getCode(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    }
 else {
      senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    }
    cfonbToolService.toUpperCase(senderRecord);
    cfonbToolService.testLength(senderRecord,NB_CHAR_PER_LINE);
    return senderRecord;
  }
 catch (  AxelorException e) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.BANK_ORDER_WRONG_SENDER_RECORD),bankOrderSeq),e,IException.MISSING_FIELD);
  }
}

Fixed version (ground truth):
/** 
 * Method to create a sender record for international transfer AFB320
 * @param company
 * @param dateTime
 * @return
 * @throws AxelorException
 */
protected String createSenderRecord() throws AxelorException {
  try {
    String senderRecord=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,2);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,2);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",sequence++,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,6);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",this.validationDateTime.toString("String_Node_Str"),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,8);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderCompany.getName(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,35);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderCompany.getName(),cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,3 * 35);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",registrationCode,cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,14);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderSeq,cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,16);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,11);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,1);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderBankDetails.getIban(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,34);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderCompany.getCurrency().getCode(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,16);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderBankDetails.getIban(),cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,34);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",senderCompany.getCurrency().getCode(),cfonbToolService.STATUS_DEPENDENT,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,4);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderFileFormat.getQualifyingOfDate(),cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,8);
    senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    senderRecord+=cfonbToolService.createZone("String_Node_Str",this.getOrderIndexType(isMultiDates,isMultiCurrencies),cfonbToolService.STATUS_OPTIONAL,cfonbToolService.FORMAT_ALPHA_NUMERIC,1);
    if (!isMultiDates) {
      senderRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderDate.toString("String_Node_Str"),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_NUMERIC,8);
    }
 else {
      senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_NUMERIC,8);
    }
    if (!isMultiCurrencies) {
      senderRecord+=cfonbToolService.createZone("String_Node_Str",bankOrderCurrency.getCode(),cfonbToolService.STATUS_MANDATORY,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    }
 else {
      senderRecord+=cfonbToolService.createZone("String_Node_Str","String_Node_Str",cfonbToolService.STATUS_NOT_USED,cfonbToolService.FORMAT_ALPHA_NUMERIC,3);
    }
    cfonbToolService.toUpperCase(senderRecord);
    cfonbToolService.testLength(senderRecord,NB_CHAR_PER_LINE);
    return senderRecord;
  }
 catch (  AxelorException e) {
    throw new AxelorException(String.format(I18n.get(IExceptionMessage.BANK_ORDER_WRONG_SENDER_RECORD),bankOrderSeq),e,IException.MISSING_FIELD);
  }
}