From f33b583083c3f10ea56fbeb57a327cf1422b1f2d Mon Sep 17 00:00:00 2001 From: Adi Narayana Raju Date: Tue, 23 Aug 2016 13:25:26 +0530 Subject: [PATCH] [FINERACT-223] In topup loan if the "Choose loan to close" is selected in modified loan product then internal server error is displaying. --- ...anApplicationWritePlatformServiceJpaRepositoryImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 0abc3fde2..585dbd96c 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",