fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From my...@apache.org
Subject [fineract-cn-accounting] 23/36: Set total value to zero if not available Do not auto close connection as it leads to an error bonecp using a closed connection
Date Mon, 22 Jan 2018 15:43:59 GMT
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-accounting.git

commit 8addaa017dfc1384ef3d855e8038ddcbc7cb1283
Author: Mark <mark.vanveen@gmail.com>
AuthorDate: Tue Oct 10 18:59:29 2017 +0200

    Set total value to zero if not available
    Do not auto close connection as it leads to an error bonecp using a closed connection
---
 .../internal/command/handler/MigrationCommandHandler.java   | 13 ++++++-------
 .../service/internal/service/IncomeStatementService.java    |  3 ++-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/service/src/main/java/io/mifos/accounting/service/internal/command/handler/MigrationCommandHandler.java
b/service/src/main/java/io/mifos/accounting/service/internal/command/handler/MigrationCommandHandler.java
index 0c497bf..ac3142b 100644
--- a/service/src/main/java/io/mifos/accounting/service/internal/command/handler/MigrationCommandHandler.java
+++ b/service/src/main/java/io/mifos/accounting/service/internal/command/handler/MigrationCommandHandler.java
@@ -170,12 +170,11 @@ public class MigrationCommandHandler {
 
   private void migrateLedgerTotals() {
     this.logger.info("Start ledger total migration ...");
-    try (final Stream<AccountEntity> accountEntityStream = this.accountRepository.findByBalanceIsNot(0.00D))
{
-      accountEntityStream.forEach(accountEntity ->
-          this.commandGateway.process(
-              new AddAmountToLedgerTotalCommand(accountEntity.getLedger().getIdentifier(),
BigDecimal.valueOf(accountEntity.getBalance()))
-          )
-      );
-    }
+
+    this.accountRepository.findByBalanceIsNot(0.00D).forEach(accountEntity ->
+        this.commandGateway.process(
+            new AddAmountToLedgerTotalCommand(accountEntity.getLedger().getIdentifier(),
BigDecimal.valueOf(accountEntity.getBalance()))
+        )
+    );
   }
 }
\ No newline at end of file
diff --git a/service/src/main/java/io/mifos/accounting/service/internal/service/IncomeStatementService.java
b/service/src/main/java/io/mifos/accounting/service/internal/service/IncomeStatementService.java
index b9de9f4..6ac379c 100644
--- a/service/src/main/java/io/mifos/accounting/service/internal/service/IncomeStatementService.java
+++ b/service/src/main/java/io/mifos/accounting/service/internal/service/IncomeStatementService.java
@@ -64,7 +64,8 @@ public class IncomeStatementService {
       this.ledgerRepository.findByParentLedgerOrderByIdentifier(ledgerEntity).forEach(subLedgerEntity
-> {
         final IncomeStatementEntry incomeStatementEntry = new IncomeStatementEntry();
         incomeStatementEntry.setDescription(subLedgerEntity.getName());
-        incomeStatementEntry.setValue(subLedgerEntity.getTotalValue());
+        final BigDecimal totalValue = subLedgerEntity.getTotalValue() != null ? subLedgerEntity.getTotalValue()
: BigDecimal.ZERO;
+        incomeStatementEntry.setValue(totalValue);
         incomeStatementSection.add(incomeStatementEntry);
       });
     });

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

Mime
View raw message