Program: 58607
Project: 58607
Buggy source:
@Override @Transactional public Message generateMessage(long objectId,String model,String tag,Template template) throws ClassNotFoundException, InstantiationException, IllegalAccessException, AxelorException, IOException {
  if (!model.equals(template.getMetaModel().getFullName())) {
    throw new AxelorException(I18n.get(IExceptionMessage.TEMPLATE_SERVICE_3),IException.INCONSISTENCY,template.getMetaModel().getFullName());
  }
  log.debug("String_Node_Str",model);
  log.debug("String_Node_Str",tag);
  log.debug("String_Node_Str",objectId);
  log.debug("String_Node_Str",template);
  initMaker(objectId,model,tag);
  String content="String_Node_Str", subject="String_Node_Str", from="String_Node_Str", replyToRecipients="String_Node_Str", toRecipients="String_Node_Str", ccRecipients="String_Node_Str", bccRecipients="String_Node_Str", addressBlock="String_Node_Str";
  int mediaTypeSelect;
  if (!Strings.isNullOrEmpty(template.getContent())) {
    maker.setTemplate(template.getContent());
    content=maker.make();
  }
  if (!Strings.isNullOrEmpty(template.getAddressBlock())) {
    maker.setTemplate(template.getAddressBlock());
    addressBlock=maker.make();
  }
  if (!Strings.isNullOrEmpty(template.getSubject())) {
    maker.setTemplate(template.getSubject());
    subject=maker.make();
    log.debug("String_Node_Str",subject);
  }
  if (!Strings.isNullOrEmpty(template.getFromAdress())) {
    maker.setTemplate(template.getFromAdress());
    from=maker.make();
    log.debug("String_Node_Str",from);
  }
  if (!Strings.isNullOrEmpty(template.getReplyToRecipients())) {
    maker.setTemplate(template.getReplyToRecipients());
    replyToRecipients=maker.make();
    log.debug("String_Node_Str",replyToRecipients);
  }
  if (template.getToRecipients() != null) {
    maker.setTemplate(template.getToRecipients());
    toRecipients=maker.make();
    log.debug("String_Node_Str",toRecipients);
  }
  if (template.getCcRecipients() != null) {
    maker.setTemplate(template.getCcRecipients());
    ccRecipients=maker.make();
    log.debug("String_Node_Str",ccRecipients);
  }
  if (template.getBccRecipients() != null) {
    maker.setTemplate(template.getBccRecipients());
    bccRecipients=maker.make();
    log.debug("String_Node_Str",bccRecipients);
  }
  mediaTypeSelect=template.getMediaTypeSelect();
  log.debug("String_Node_Str",mediaTypeSelect);
  log.debug("String_Node_Str",content);
  Message message=messageService.createMessage(model,Long.valueOf(objectId).intValue(),subject,content,getEmailAddress(from),getEmailAddresses(replyToRecipients),getEmailAddresses(toRecipients),getEmailAddresses(ccRecipients),getEmailAddresses(bccRecipients),null,addressBlock,mediaTypeSelect);
  message=Beans.get(MessageRepository.class).save(message);
  messageService.attachMetaFiles(message,getMetaFiles(template));
  return message;
}

Fixed version (ground truth):
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public Message generateMessage(long objectId,String model,String tag,Template template) throws ClassNotFoundException, InstantiationException, IllegalAccessException, AxelorException, IOException {
  if (!model.equals(template.getMetaModel().getFullName())) {
    throw new AxelorException(I18n.get(IExceptionMessage.TEMPLATE_SERVICE_3),IException.INCONSISTENCY,template.getMetaModel().getFullName());
  }
  log.debug("String_Node_Str",model);
  log.debug("String_Node_Str",tag);
  log.debug("String_Node_Str",objectId);
  log.debug("String_Node_Str",template);
  initMaker(objectId,model,tag);
  String content="String_Node_Str", subject="String_Node_Str", from="String_Node_Str", replyToRecipients="String_Node_Str", toRecipients="String_Node_Str", ccRecipients="String_Node_Str", bccRecipients="String_Node_Str", addressBlock="String_Node_Str";
  int mediaTypeSelect;
  if (!Strings.isNullOrEmpty(template.getContent())) {
    maker.setTemplate(template.getContent());
    content=maker.make();
  }
  if (!Strings.isNullOrEmpty(template.getAddressBlock())) {
    maker.setTemplate(template.getAddressBlock());
    addressBlock=maker.make();
  }
  if (!Strings.isNullOrEmpty(template.getSubject())) {
    maker.setTemplate(template.getSubject());
    subject=maker.make();
    log.debug("String_Node_Str",subject);
  }
  if (!Strings.isNullOrEmpty(template.getFromAdress())) {
    maker.setTemplate(template.getFromAdress());
    from=maker.make();
    log.debug("String_Node_Str",from);
  }
  if (!Strings.isNullOrEmpty(template.getReplyToRecipients())) {
    maker.setTemplate(template.getReplyToRecipients());
    replyToRecipients=maker.make();
    log.debug("String_Node_Str",replyToRecipients);
  }
  if (template.getToRecipients() != null) {
    maker.setTemplate(template.getToRecipients());
    toRecipients=maker.make();
    log.debug("String_Node_Str",toRecipients);
  }
  if (template.getCcRecipients() != null) {
    maker.setTemplate(template.getCcRecipients());
    ccRecipients=maker.make();
    log.debug("String_Node_Str",ccRecipients);
  }
  if (template.getBccRecipients() != null) {
    maker.setTemplate(template.getBccRecipients());
    bccRecipients=maker.make();
    log.debug("String_Node_Str",bccRecipients);
  }
  mediaTypeSelect=template.getMediaTypeSelect();
  log.debug("String_Node_Str",mediaTypeSelect);
  log.debug("String_Node_Str",content);
  Message message=messageService.createMessage(model,Long.valueOf(objectId).intValue(),subject,content,getEmailAddress(from),getEmailAddresses(replyToRecipients),getEmailAddresses(toRecipients),getEmailAddresses(ccRecipients),getEmailAddresses(bccRecipients),null,addressBlock,mediaTypeSelect);
  message=Beans.get(MessageRepository.class).save(message);
  messageService.attachMetaFiles(message,getMetaFiles(template));
  return message;
}