fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awa...@apache.org
Subject [fineract] branch develop updated: FINERACT-839: NPE when creating a Loan for a client fix
Date Thu, 23 Jan 2020 15:32:22 GMT
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new e1666ba  FINERACT-839: NPE when creating a Loan for a client fix
     new dfcad32  Merge pull request #696 from adamsaghy/bugfix/loanproductdata
e1666ba is described below

commit e1666ba8fc2b5c74f5bb6ad835cbae38b1cfce47
Author: Adam Saghy <adamsaghy@gmail.com>
AuthorDate: Thu Jan 23 15:10:28 2020 +0100

    FINERACT-839: NPE when creating a Loan for a client fix
---
 .../loanproduct/data/LoanProductData.java          | 107 ++++++++++-----------
 1 file changed, 53 insertions(+), 54 deletions(-)

diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java
index 6c5676a..e6493ca 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java
@@ -49,6 +49,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import net.sf.ehcache.util.FindBugsSuppressWarnings;
 
 /**
  * Immutable data object to represent loan products.
@@ -473,10 +474,10 @@ public class LoanProductData implements Serializable {
     }
 
     public static LoanProductData loanProductWithFloatingRates(final Long id, final String
name,
-            final boolean isLinkedToFloatingInterestRates, final Integer floatingRateId,
final String floatingRateName,
-            final BigDecimal interestRateDifferential, final BigDecimal minDifferentialLendingRate,
-            final BigDecimal defaultDifferentialLendingRate, final BigDecimal maxDifferentialLendingRate,
-            final boolean isFloatingInterestRateCalculationAllowed) {
+                                                               final boolean isLinkedToFloatingInterestRates,
final Integer floatingRateId, final String floatingRateName,
+                                                               final BigDecimal interestRateDifferential,
final BigDecimal minDifferentialLendingRate,
+                                                               final BigDecimal defaultDifferentialLendingRate,
final BigDecimal maxDifferentialLendingRate,
+                                                               final boolean isFloatingInterestRateCalculationAllowed)
{
         final String shortName = null;
         final String description = null;
         final CurrencyData currency = CurrencyData.blank();
@@ -567,9 +568,9 @@ public class LoanProductData implements Serializable {
     }
 
     public static LoanProductData withAccountingDetails(final LoanProductData productData,
final Map<String, Object> accountingMappings,
-            final Collection<PaymentTypeToGLAccountMapper> paymentChannelToFundSourceMappings,
-            final Collection<ChargeToGLAccountMapper> feeToGLAccountMappings,
-            final Collection<ChargeToGLAccountMapper> penaltyToGLAccountMappings) {
+                                                        final Collection<PaymentTypeToGLAccountMapper>
paymentChannelToFundSourceMappings,
+                                                        final Collection<ChargeToGLAccountMapper>
feeToGLAccountMappings,
+                                                        final Collection<ChargeToGLAccountMapper>
penaltyToGLAccountMappings) {
         productData.accountingMappings = accountingMappings;
         productData.paymentChannelToFundSourceMappings = paymentChannelToFundSourceMappings;
         productData.feeToIncomeAccountMappings = feeToGLAccountMappings;
@@ -578,30 +579,30 @@ public class LoanProductData implements Serializable {
     }
 
     public LoanProductData(final Long id, final String name, final String shortName, final
String description, final CurrencyData currency,
-            final BigDecimal principal, final BigDecimal minPrincipal, final BigDecimal maxPrincipal,
final BigDecimal tolerance,
-            final Integer numberOfRepayments, final Integer minNumberOfRepayments, final
Integer maxNumberOfRepayments,
-            final Integer repaymentEvery, final BigDecimal interestRatePerPeriod, final BigDecimal
minInterestRatePerPeriod,
-            final BigDecimal maxInterestRatePerPeriod, final BigDecimal annualInterestRate,
final EnumOptionData repaymentFrequencyType,
-            final EnumOptionData interestRateFrequencyType, final EnumOptionData amortizationType,
final EnumOptionData interestType,
-            final EnumOptionData interestCalculationPeriodType, final Boolean allowPartialPeriodInterestCalcualtion,
final Long fundId,
-            final String fundName, final Long transactionProcessingStrategyId, final String
transactionProcessingStrategyName,
-            final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods,
final Integer graceOnInterestPayment, final Integer graceOnInterestCharged,
-            final Collection<ChargeData> charges, final EnumOptionData accountingType,
final boolean includeInBorrowerCycle, boolean useBorrowerCycle, final LocalDate startDate,
-            final LocalDate closeDate, final String status, final String externalId,
-            Collection<LoanProductBorrowerCycleVariationData> principalVariations,
-            Collection<LoanProductBorrowerCycleVariationData> interestRateVariations,
-            Collection<LoanProductBorrowerCycleVariationData> numberOfRepaymentVariations,
Boolean multiDisburseLoan,
-            Integer maxTrancheCount, BigDecimal outstandingLoanBalance, final Integer graceOnArrearsAgeing,
final Integer overdueDaysForNPA,
-            final EnumOptionData daysInMonthType, final EnumOptionData daysInYearType, final
boolean isInterestRecalculationEnabled, final LoanProductInterestRecalculationData interestRecalculationData,
-            final Integer minimumDaysBetweenDisbursalAndFirstRepayment, boolean holdGuaranteeFunds,
-            final LoanProductGuaranteeData loanProductGuaranteeData, final BigDecimal principalThresholdForLastInstallment,
-            final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion, boolean canDefineInstallmentAmount,
-            Integer installmentAmountInMultiplesOf, LoanProductConfigurableAttributes allowAttributeOverrides,
-            boolean isLinkedToFloatingInterestRates, Integer floatingRateId, String floatingRateName,
BigDecimal interestRateDifferential,
-            BigDecimal minDifferentialLendingRate, BigDecimal defaultDifferentialLendingRate,
BigDecimal maxDifferentialLendingRate,
-            boolean isFloatingInterestRateCalculationAllowed, final boolean isVariableInstallmentsAllowed,
-            final Integer minimumGapBetweenInstallments, final Integer maximumGapBetweenInstallments,
-            final boolean syncExpectedWithDisbursementDate, final boolean canUseForTopup,
final boolean isEqualAmortization) {
+                           final BigDecimal principal, final BigDecimal minPrincipal, final
BigDecimal maxPrincipal, final BigDecimal tolerance,
+                           final Integer numberOfRepayments, final Integer minNumberOfRepayments,
final Integer maxNumberOfRepayments,
+                           final Integer repaymentEvery, final BigDecimal interestRatePerPeriod,
final BigDecimal minInterestRatePerPeriod,
+                           final BigDecimal maxInterestRatePerPeriod, final BigDecimal annualInterestRate,
final EnumOptionData repaymentFrequencyType,
+                           final EnumOptionData interestRateFrequencyType, final EnumOptionData
amortizationType, final EnumOptionData interestType,
+                           final EnumOptionData interestCalculationPeriodType, final Boolean
allowPartialPeriodInterestCalcualtion, final Long fundId,
+                           final String fundName, final Long transactionProcessingStrategyId,
final String transactionProcessingStrategyName,
+                           final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods,
final Integer graceOnInterestPayment, final Integer graceOnInterestCharged,
+                           final Collection<ChargeData> charges, final EnumOptionData
accountingType, final boolean includeInBorrowerCycle, boolean useBorrowerCycle, final LocalDate
startDate,
+                           final LocalDate closeDate, final String status, final String externalId,
+                           Collection<LoanProductBorrowerCycleVariationData> principalVariations,
+                           Collection<LoanProductBorrowerCycleVariationData> interestRateVariations,
+                           Collection<LoanProductBorrowerCycleVariationData> numberOfRepaymentVariations,
Boolean multiDisburseLoan,
+                           Integer maxTrancheCount, BigDecimal outstandingLoanBalance, final
Integer graceOnArrearsAgeing, final Integer overdueDaysForNPA,
+                           final EnumOptionData daysInMonthType, final EnumOptionData daysInYearType,
final boolean isInterestRecalculationEnabled, final LoanProductInterestRecalculationData interestRecalculationData,
+                           final Integer minimumDaysBetweenDisbursalAndFirstRepayment, boolean
holdGuaranteeFunds,
+                           final LoanProductGuaranteeData loanProductGuaranteeData, final
BigDecimal principalThresholdForLastInstallment,
+                           final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion, boolean
canDefineInstallmentAmount,
+                           Integer installmentAmountInMultiplesOf, LoanProductConfigurableAttributes
allowAttributeOverrides,
+                           boolean isLinkedToFloatingInterestRates, Integer floatingRateId,
String floatingRateName, BigDecimal interestRateDifferential,
+                           BigDecimal minDifferentialLendingRate, BigDecimal defaultDifferentialLendingRate,
BigDecimal maxDifferentialLendingRate,
+                           boolean isFloatingInterestRateCalculationAllowed, final boolean
isVariableInstallmentsAllowed,
+                           final Integer minimumGapBetweenInstallments, final Integer maximumGapBetweenInstallments,
+                           final boolean syncExpectedWithDisbursementDate, final boolean
canUseForTopup, final boolean isEqualAmortization) {
         this.id = id;
         this.name = name;
         this.shortName = shortName;
@@ -710,18 +711,18 @@ public class LoanProductData implements Serializable {
     }
 
     public LoanProductData(final LoanProductData productData, final Collection<ChargeData>
chargeOptions,
-            final Collection<ChargeData> penaltyOptions, final Collection<PaymentTypeData>
paymentTypeOptions,
-            final Collection<CurrencyData> currencyOptions, final List<EnumOptionData>
amortizationTypeOptions,
-            final List<EnumOptionData> interestTypeOptions, final List<EnumOptionData>
interestCalculationPeriodTypeOptions,
-            final List<EnumOptionData> repaymentFrequencyTypeOptions, final List<EnumOptionData>
interestRateFrequencyTypeOptions,
-            final Collection<FundData> fundOptions, final Collection<TransactionProcessingStrategyData>
transactionStrategyOptions,
-            final Map<String, List<GLAccountData>> accountingMappingOptions,
final List<EnumOptionData> accountingRuleOptions,
-            final List<EnumOptionData> valueConditionTypeOptions, final List<EnumOptionData>
daysInMonthTypeOptions,
-            final List<EnumOptionData> daysInYearTypeOptions, final List<EnumOptionData>
interestRecalculationCompoundingTypeOptions,
-            final List<EnumOptionData> rescheduleStrategyTypeOptions, final List<EnumOptionData>
interestRecalculationFrequencyTypeOptions,
-            final List<EnumOptionData> preCloseInterestCalculationStrategyOptions,
final List<FloatingRateData> floatingRateOptions,
-            final List<EnumOptionData> interestRecalculationNthDayTypeOptions,
-            final List<EnumOptionData> interestRecalculationDayOfWeekTypeOptions) {
+                           final Collection<ChargeData> penaltyOptions, final Collection<PaymentTypeData>
paymentTypeOptions,
+                           final Collection<CurrencyData> currencyOptions, final List<EnumOptionData>
amortizationTypeOptions,
+                           final List<EnumOptionData> interestTypeOptions, final List<EnumOptionData>
interestCalculationPeriodTypeOptions,
+                           final List<EnumOptionData> repaymentFrequencyTypeOptions,
final List<EnumOptionData> interestRateFrequencyTypeOptions,
+                           final Collection<FundData> fundOptions, final Collection<TransactionProcessingStrategyData>
transactionStrategyOptions,
+                           final Map<String, List<GLAccountData>> accountingMappingOptions,
final List<EnumOptionData> accountingRuleOptions,
+                           final List<EnumOptionData> valueConditionTypeOptions, final
List<EnumOptionData> daysInMonthTypeOptions,
+                           final List<EnumOptionData> daysInYearTypeOptions, final
List<EnumOptionData> interestRecalculationCompoundingTypeOptions,
+                           final List<EnumOptionData> rescheduleStrategyTypeOptions,
final List<EnumOptionData> interestRecalculationFrequencyTypeOptions,
+                           final List<EnumOptionData> preCloseInterestCalculationStrategyOptions,
final List<FloatingRateData> floatingRateOptions,
+                           final List<EnumOptionData> interestRecalculationNthDayTypeOptions,
+                           final List<EnumOptionData> interestRecalculationDayOfWeekTypeOptions)
{
         this.id = productData.id;
         this.name = productData.name;
         this.shortName = productData.shortName;
@@ -1134,17 +1135,15 @@ public class LoanProductData implements Serializable {
         if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationCompoundingFrequencyInterval();
}
         return null;
     }
+
+    @FindBugsSuppressWarnings("NP_BOOLEAN_RETURN_NULL")
     public Boolean isCompoundingToBePostedAsTransaction() {
-        if (isInterestRecalculationEnabled()) {
-            return this.interestRecalculationData.isCompoundingToBePostedAsTransaction();
-        } else {
-            return !this.interestRecalculationData.isCompoundingToBePostedAsTransaction();
-        }
+        return isInterestRecalculationEnabled() ? this.interestRecalculationData.isCompoundingToBePostedAsTransaction()
: null;
     }
+
+    @FindBugsSuppressWarnings("NP_BOOLEAN_RETURN_NULL")
     public Boolean allowCompoundingOnEod() {
-        if (isInterestRecalculationEnabled()) {
-            return this.interestRecalculationData.allowCompoundingOnEod();
-        } return !this.interestRecalculationData.allowCompoundingOnEod();
+        return isInterestRecalculationEnabled() ? this.interestRecalculationData.allowCompoundingOnEod()
: null;
     }
 
     public boolean canDefineInstallmentAmount() {
@@ -1200,9 +1199,9 @@ public class LoanProductData implements Serializable {
         return syncExpectedWithDisbursementDate;
     }
 
-        public boolean canUseForTopup() {
-            return this.canUseForTopup;
-        }
+    public boolean canUseForTopup() {
+        return this.canUseForTopup;
+    }
 
     public BigDecimal getInterestRateDifferential() {
         return this.interestRateDifferential;


Mime
View raw message