Program: 58779
Project: 58779
Buggy source:
/** 
 * Créer les lignes de TVA de la facure. La création des lignes de TVA se basent sur les lignes de factures
 * @param invoice La facture.
 * @param invoiceLines Les lignes de facture.
 * @return La liste des lignes de TVA de la facture.
 */
@Override public List<InvoiceLineTax> creates(){
  List<InvoiceLineTax> invoiceLineTaxList=new ArrayList<InvoiceLineTax>();
  Map<TaxLine,InvoiceLineTax> map=new HashMap<TaxLine,InvoiceLineTax>();
  if (invoiceLines != null && !invoiceLines.isEmpty()) {
    LOG.debug("String_Node_Str");
    for (    InvoiceLine invoiceLine : invoiceLines) {
      if (!invoiceLine.getIsTitleLine()) {
        TaxLine taxLine=invoiceLine.getTaxLine();
        LOG.debug("String_Node_Str",taxLine);
        if (map.containsKey(taxLine)) {
          InvoiceLineTax invoiceLineTax=map.get(taxLine);
          invoiceLineTax.setExTaxBase(invoiceLineTax.getExTaxBase().add(invoiceLine.getExTaxTotal()));
          invoiceLineTax.setCompanyExTaxBase(invoiceLineTax.getCompanyExTaxBase().add(invoiceLine.getCompanyExTaxTotal()));
        }
 else {
          InvoiceLineTax invoiceLineTax=new InvoiceLineTax();
          invoiceLineTax.setInvoice(invoice);
          invoiceLineTax.setExTaxBase(invoiceLine.getExTaxTotal());
          invoiceLineTax.setCompanyExTaxBase(invoiceLine.getCompanyExTaxTotal());
          invoiceLineTax.setTaxLine(taxLine);
          map.put(taxLine,invoiceLineTax);
        }
      }
    }
  }
  for (  InvoiceLineTax invoiceLineTax : map.values()) {
    BigDecimal exTaxBase=invoiceLineTax.getExTaxBase();
    BigDecimal taxTotal=computeAmount(exTaxBase,invoiceLineTax.getTaxLine().getValue());
    invoiceLineTax.setTaxTotal(taxTotal);
    invoiceLineTax.setInTaxTotal(exTaxBase.add(taxTotal));
    BigDecimal companyExTaxBase=invoiceLineTax.getCompanyExTaxBase();
    BigDecimal companyTaxTotal=computeAmount(companyExTaxBase,invoiceLineTax.getTaxLine().getValue());
    invoiceLineTax.setCompanyTaxTotal(companyTaxTotal);
    invoiceLineTax.setCompanyInTaxTotal(companyExTaxBase.add(companyTaxTotal));
    invoiceLineTaxList.add(invoiceLineTax);
    LOG.debug("String_Node_Str",new Object[]{invoiceLineTax.getTaxTotal(),invoiceLineTax.getInTaxTotal()});
  }
  return invoiceLineTaxList;
}

Fixed version (ground truth):
/** 
 * Créer les lignes de TVA de la facure. La création des lignes de TVA se basent sur les lignes de factures
 * @param invoice La facture.
 * @param invoiceLines Les lignes de facture.
 * @return La liste des lignes de TVA de la facture.
 */
@Override public List<InvoiceLineTax> creates(){
  List<InvoiceLineTax> invoiceLineTaxList=new ArrayList<InvoiceLineTax>();
  Map<TaxLine,InvoiceLineTax> map=new HashMap<TaxLine,InvoiceLineTax>();
  if (invoiceLines != null && !invoiceLines.isEmpty()) {
    LOG.debug("String_Node_Str");
    for (    InvoiceLine invoiceLine : invoiceLines) {
      if (!invoiceLine.getIsTitleLine()) {
        TaxLine taxLine=invoiceLine.getTaxLine();
        LOG.debug("String_Node_Str",taxLine);
        if (map.containsKey(taxLine)) {
          InvoiceLineTax invoiceLineTax=map.get(taxLine);
          invoiceLineTax.setExTaxBase(invoiceLineTax.getExTaxBase().add(invoiceLine.getExTaxTotal()));
          invoiceLineTax.setCompanyExTaxBase(invoiceLineTax.getCompanyExTaxBase().add(invoiceLine.getCompanyExTaxTotal()).setScale(2,RoundingMode.HALF_UP));
        }
 else {
          InvoiceLineTax invoiceLineTax=new InvoiceLineTax();
          invoiceLineTax.setInvoice(invoice);
          invoiceLineTax.setExTaxBase(invoiceLine.getExTaxTotal());
          invoiceLineTax.setCompanyExTaxBase(invoiceLine.getCompanyExTaxTotal().setScale(2,RoundingMode.HALF_UP));
          invoiceLineTax.setTaxLine(taxLine);
          map.put(taxLine,invoiceLineTax);
        }
      }
    }
  }
  for (  InvoiceLineTax invoiceLineTax : map.values()) {
    BigDecimal exTaxBase=invoiceLineTax.getExTaxBase();
    BigDecimal taxTotal=computeAmount(exTaxBase,invoiceLineTax.getTaxLine().getValue());
    invoiceLineTax.setTaxTotal(taxTotal);
    invoiceLineTax.setInTaxTotal(exTaxBase.add(taxTotal));
    BigDecimal companyExTaxBase=invoiceLineTax.getCompanyExTaxBase();
    BigDecimal companyTaxTotal=computeAmount(companyExTaxBase,invoiceLineTax.getTaxLine().getValue());
    invoiceLineTax.setCompanyTaxTotal(companyTaxTotal);
    invoiceLineTax.setCompanyInTaxTotal(companyExTaxBase.add(companyTaxTotal));
    invoiceLineTaxList.add(invoiceLineTax);
    LOG.debug("String_Node_Str",new Object[]{invoiceLineTax.getTaxTotal(),invoiceLineTax.getInTaxTotal()});
  }
  return invoiceLineTaxList;
}