FINERACT-822 enable BigDecimalEquals error
This commit is contained in:
committed by
Yemdjih Kaze Nasser
parent
73a8816f13
commit
17cb620ec0
@@ -316,7 +316,6 @@ tasks.withType(JavaCompile) {
|
|||||||
"SameNameButDifferent",
|
"SameNameButDifferent",
|
||||||
"StringSplitter",
|
"StringSplitter",
|
||||||
"MissingOverride",
|
"MissingOverride",
|
||||||
"BigDecimalEquals",
|
|
||||||
"ImmutableEnumChecker",
|
"ImmutableEnumChecker",
|
||||||
"EqualsUnsafeCast",
|
"EqualsUnsafeCast",
|
||||||
"BoxedPrimitiveEquality",
|
"BoxedPrimitiveEquality",
|
||||||
@@ -341,6 +340,7 @@ tasks.withType(JavaCompile) {
|
|||||||
"MultiVariableDeclaration",
|
"MultiVariableDeclaration",
|
||||||
"AssertEqualsArgumentOrderChecker",
|
"AssertEqualsArgumentOrderChecker",
|
||||||
"EmptySetMultibindingContributions",
|
"EmptySetMultibindingContributions",
|
||||||
|
"BigDecimalEquals",
|
||||||
"MixedArrayDimensions",
|
"MixedArrayDimensions",
|
||||||
"PackageLocation",
|
"PackageLocation",
|
||||||
"UseBinds",
|
"UseBinds",
|
||||||
|
|||||||
+1
-1
@@ -506,7 +506,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
|||||||
|
|
||||||
BigDecimal overpaid = this.loanReadPlatformService.retrieveTotalPaidInAdvance(fromLoanAccountId).getPaidInAdvance();
|
BigDecimal overpaid = this.loanReadPlatformService.retrieveTotalPaidInAdvance(fromLoanAccountId).getPaidInAdvance();
|
||||||
|
|
||||||
if (overpaid == null || overpaid.equals(BigDecimal.ZERO) || transactionAmount.floatValue() > overpaid.floatValue()) {
|
if (overpaid == null || overpaid.compareTo(BigDecimal.ZERO) == 0 ? Boolean.TRUE:Boolean.FALSE || transactionAmount.floatValue() > overpaid.floatValue()) {
|
||||||
if(overpaid == null) {
|
if(overpaid == null) {
|
||||||
overpaid = BigDecimal.ZERO;
|
overpaid = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -27,6 +27,7 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartS
|
|||||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.toPeriodParamName;
|
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.toPeriodParamName;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -304,7 +305,7 @@ public class InterestRateChartSlabFields {
|
|||||||
|
|
||||||
public boolean isBigDecimalSame(final BigDecimal obj1, final BigDecimal obj2) {
|
public boolean isBigDecimalSame(final BigDecimal obj1, final BigDecimal obj2) {
|
||||||
if (obj1 == null || obj2 == null) {
|
if (obj1 == null || obj2 == null) {
|
||||||
if (Objects.equals(obj1, obj2)) { return true; }
|
if (Objects.compare(obj1,obj2, Comparator.nullsFirst(Comparator.naturalOrder())) == 0 ? Boolean.TRUE:Boolean.FALSE){ return true; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return obj1.compareTo(obj2) == 0;
|
return obj1.compareTo(obj2) == 0;
|
||||||
|
|||||||
+1
-1
@@ -2834,7 +2834,7 @@ public class Loan extends AbstractPersistableCustom {
|
|||||||
this.actualDisbursementDate = null;
|
this.actualDisbursementDate = null;
|
||||||
this.disbursedBy = null;
|
this.disbursedBy = null;
|
||||||
boolean isDisbursedAmountChanged =
|
boolean isDisbursedAmountChanged =
|
||||||
!this.approvedPrincipal.equals(this.loanRepaymentScheduleDetail.getPrincipal().getAmount());
|
approvedPrincipal.compareTo(this.loanRepaymentScheduleDetail.getPrincipal().getAmount()) == 0 ? Boolean.FALSE:Boolean.TRUE;
|
||||||
this.loanRepaymentScheduleDetail.setPrincipal(this.approvedPrincipal);
|
this.loanRepaymentScheduleDetail.setPrincipal(this.approvedPrincipal);
|
||||||
if (this.loanProduct.isMultiDisburseLoan()) {
|
if (this.loanProduct.isMultiDisburseLoan()) {
|
||||||
for (final LoanDisbursementDetails details : this.disbursementDetails) {
|
for (final LoanDisbursementDetails details : this.disbursementDetails) {
|
||||||
|
|||||||
+1
-1
@@ -2959,7 +2959,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
private void checkIfLoanIsPaidInAdvance(final Long loanId, final BigDecimal transactionAmount) {
|
private void checkIfLoanIsPaidInAdvance(final Long loanId, final BigDecimal transactionAmount) {
|
||||||
BigDecimal overpaid = this.loanReadPlatformService.retrieveTotalPaidInAdvance(loanId).getPaidInAdvance();
|
BigDecimal overpaid = this.loanReadPlatformService.retrieveTotalPaidInAdvance(loanId).getPaidInAdvance();
|
||||||
|
|
||||||
if (overpaid == null || overpaid.equals(new BigDecimal(0)) || transactionAmount.floatValue() > overpaid.floatValue()) {
|
if (overpaid == null || overpaid.compareTo(BigDecimal.ZERO) == 0 ? Boolean.TRUE:Boolean.FALSE || transactionAmount.floatValue() > overpaid.floatValue()) {
|
||||||
if (overpaid == null) {
|
if (overpaid == null) {
|
||||||
overpaid = BigDecimal.ZERO;
|
overpaid = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -746,7 +746,7 @@ public class FixedDepositAccount extends SavingsAccount {
|
|||||||
BigDecimal applicableInterestRate = this.chart.getApplicableInterestRate(depositAmount, depositStartDate(),
|
BigDecimal applicableInterestRate = this.chart.getApplicableInterestRate(depositAmount, depositStartDate(),
|
||||||
calculateMaturityDate(), this.client);
|
calculateMaturityDate(), this.client);
|
||||||
|
|
||||||
if (applicableInterestRate.equals(BigDecimal.ZERO)) {
|
if (applicableInterestRate.compareTo(BigDecimal.ZERO) == 0 ? Boolean.TRUE:Boolean.FALSE) {
|
||||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(
|
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(
|
||||||
"no.applicable.interest.rate.is.found.based.on.amount.and.deposit.period");
|
"no.applicable.interest.rate.is.found.based.on.amount.and.deposit.period");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1042,7 +1042,7 @@ public class RecurringDepositAccount extends SavingsAccount {
|
|||||||
BigDecimal applicableInterestRate = this.chart.getApplicableInterestRate(maturityAmount, depositStartDate(), maturityDate,
|
BigDecimal applicableInterestRate = this.chart.getApplicableInterestRate(maturityAmount, depositStartDate(), maturityDate,
|
||||||
this.client);
|
this.client);
|
||||||
|
|
||||||
if (applicableInterestRate.equals(BigDecimal.ZERO)) {
|
if (applicableInterestRate.compareTo(BigDecimal.ZERO) == 0 ? Boolean.TRUE:Boolean.FALSE) {
|
||||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(
|
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(
|
||||||
"no.applicable.interest.rate.is.found.based.on.amount.and.deposit.period");
|
"no.applicable.interest.rate.is.found.based.on.amount.and.deposit.period");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -518,7 +518,7 @@ public class ShareAccount extends AbstractPersistableCustom {
|
|||||||
for (ShareAccountTransaction tran : this.shareAccountTransactions) {
|
for (ShareAccountTransaction tran : this.shareAccountTransactions) {
|
||||||
if (tran.getPurchasedDate().equals(transaction.getPurchasedDate())
|
if (tran.getPurchasedDate().equals(transaction.getPurchasedDate())
|
||||||
&& tran.getTotalShares().equals(transaction.getTotalShares())
|
&& tran.getTotalShares().equals(transaction.getTotalShares())
|
||||||
&& tran.getPurchasePrice().equals(transaction.getPurchasePrice())
|
&& tran.getPurchasePrice().compareTo(transaction.getPurchasePrice()) == 0 ? Boolean.TRUE:Boolean.FALSE
|
||||||
&& tran.getTransactionStatus().equals(transaction.getTransactionStatus())
|
&& tran.getTransactionStatus().equals(transaction.getTransactionStatus())
|
||||||
&& tran.getTransactionType().equals(transaction.getTransactionType())) {
|
&& tran.getTransactionType().equals(transaction.getTransactionType())) {
|
||||||
returnTrans = tran;
|
returnTrans = tran;
|
||||||
|
|||||||
+2
-2
@@ -248,7 +248,7 @@ public class ShareProduct extends AbstractAuditableCustom {
|
|||||||
|
|
||||||
public boolean setUnitPrice(BigDecimal unitPrice) {
|
public boolean setUnitPrice(BigDecimal unitPrice) {
|
||||||
boolean returnValue = false;
|
boolean returnValue = false;
|
||||||
if (!this.unitPrice.equals(unitPrice)) {
|
if (this.unitPrice.compareTo(unitPrice) == 0 ? Boolean.FALSE:Boolean.TRUE) {
|
||||||
this.unitPrice = unitPrice;
|
this.unitPrice = unitPrice;
|
||||||
returnValue = true;
|
returnValue = true;
|
||||||
}
|
}
|
||||||
@@ -363,7 +363,7 @@ public class ShareProduct extends AbstractAuditableCustom {
|
|||||||
|
|
||||||
public boolean setshareCapitalValue(BigDecimal shareCapitalValue) {
|
public boolean setshareCapitalValue(BigDecimal shareCapitalValue) {
|
||||||
boolean updated = false;
|
boolean updated = false;
|
||||||
if (this.shareCapital == null || !this.shareCapital.equals(shareCapitalValue)) {
|
if (this.shareCapital == null || this.shareCapital.compareTo(shareCapitalValue) == 0 ? Boolean.FALSE:Boolean.TRUE) {
|
||||||
this.shareCapital = shareCapitalValue;
|
this.shareCapital = shareCapitalValue;
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user