Repository: incubator-fineract Updated Branches: refs/heads/develop 8327b112a -> f33b58308
[FINERACT-223] In topup loan if the "Choose loan to close" is selected in modified loan product then internal server error is displaying. Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/f33b5830 Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/f33b5830 Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/f33b5830 Branch: refs/heads/develop Commit: f33b583083c3f10ea56fbeb57a327cf1422b1f2d Parents: 8327b11 Author: Adi Narayana Raju <adi.r...@confluxtechnologies.com> Authored: Tue Aug 23 13:25:26 2016 +0530 Committer: Adi Narayana Raju <adi.r...@confluxtechnologies.com> Committed: Tue Aug 23 13:25:26 2016 +0530 ---------------------------------------------------------------------- .../LoanApplicationWritePlatformServiceJpaRepositoryImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/f33b5830/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java index 0abc3fd..585dbd9 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java @@ -674,13 +674,16 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa if(existingLoanApplication.isTopup()){ final Long loanIdToClose = command.longValueOfParameterNamed(LoanApiConstants.loanIdToClose); LoanTopupDetails existingLoanTopupDetails = existingLoanApplication.getTopupLoanDetails(); - final Long existingLoanIdToClose = existingLoanTopupDetails.getLoanIdToClose(); if(existingLoanTopupDetails == null - || (existingLoanTopupDetails != null && existingLoanIdToClose != loanIdToClose) + || (existingLoanTopupDetails != null && existingLoanTopupDetails.getLoanIdToClose() != loanIdToClose) || changes.containsKey("submittedOnDate") || changes.containsKey("expectedDisbursementDate") || changes.containsKey("principal") || changes.containsKey(LoanApiConstants.disbursementDataParameterName)){ + Long existingLoanIdToClose = null; + if(existingLoanTopupDetails != null){ + existingLoanIdToClose = existingLoanTopupDetails.getLoanIdToClose(); + } final Loan loanToClose = this.loanRepository.findNonClosedLoanThatBelongsToClient(loanIdToClose, existingLoanApplication.getClientId()); if(loanToClose == null){ throw new GeneralPlatformDomainRuleException("error.msg.loan.loanIdToClose.no.active.loan.associated.to.client.found",