FINERACT-822 enable OperatorPrecedence error

This commit is contained in:
percyashu
2020-06-08 02:32:30 +01:00
committed by Yemdjih Kaze Nasser
parent 62d8d49312
commit d5af661231
11 changed files with 45 additions and 45 deletions
+1 -1
View File
@@ -327,7 +327,6 @@ tasks.withType(JavaCompile) {
"UnusedNestedClass", "UnusedNestedClass",
"UndefinedEquals", "UndefinedEquals",
"JdkObsolete", "JdkObsolete",
"OperatorPrecedence"
) )
//TODO gradually enable these checks //TODO gradually enable these checks
error( error(
@@ -368,6 +367,7 @@ tasks.withType(JavaCompile) {
"CompareToZero", "CompareToZero",
"NarrowingCompoundAssignment", "NarrowingCompoundAssignment",
"MissingCasesInEnumSwitch", "MissingCasesInEnumSwitch",
"OperatorPrecedence",
// "ReturnMissingNullable", // "ReturnMissingNullable",
// "InconsistentOverloads", // "InconsistentOverloads",
// "MethodCanBeStatic", // "MethodCanBeStatic",
@@ -204,9 +204,9 @@ public class CommandWrapper {
public boolean isUpdate() { public boolean isUpdate() {
// permissions resource has special update which involves no resource. // permissions resource has special update which involves no resource.
return isPermissionResource() && isUpdateOperation() || isCurrencyResource() && isUpdateOperation() || isCacheResource() return (isPermissionResource() && isUpdateOperation()) || (isCurrencyResource() && isUpdateOperation()) || (isCacheResource()
&& isUpdateOperation() || isWorkingDaysResource() && isUpdateOperation() || isPasswordPreferencesResource() && isUpdateOperation()) || (isWorkingDaysResource() && isUpdateOperation()) || (isPasswordPreferencesResource()
&& isUpdateOperation() || isUpdateOperation() && this.entityId != null; && isUpdateOperation()) || (isUpdateOperation() && (this.entityId != null));
} }
public boolean isCacheResource() { public boolean isCacheResource() {
@@ -338,4 +338,4 @@ public class CommandWrapper {
return this.actionName.equalsIgnoreCase("UPDATE") && this.entityName.equalsIgnoreCase("DISBURSEMENTDETAIL") return this.actionName.equalsIgnoreCase("UPDATE") && this.entityName.equalsIgnoreCase("DISBURSEMENTDETAIL")
&& this.entityId == null; && this.entityId == null;
} }
} }
@@ -114,8 +114,8 @@ public class GlobalConfigurationProperty extends AbstractPersistableCustom {
final String passwordPropertyName = "force-password-reset-days"; final String passwordPropertyName = "force-password-reset-days";
if (this.name.equalsIgnoreCase(passwordPropertyName)) { if (this.name.equalsIgnoreCase(passwordPropertyName)) {
if (this.enabled == true && command.hasParameter(valueParamName) && this.value == 0 || this.enabled == true if (((this.enabled == true) && command.hasParameter(valueParamName) && (this.value == 0)) || ((this.enabled == true)
&& !command.hasParameter(valueParamName) && previousValue == 0) { throw new ForcePasswordResetException(); } && !command.hasParameter(valueParamName) && (previousValue == 0))) { throw new ForcePasswordResetException(); }
} }
return actualChanges; return actualChanges;
@@ -135,4 +135,4 @@ public class GlobalConfigurationProperty extends AbstractPersistableCustom {
return this.name; return this.name;
} }
} }
@@ -135,7 +135,7 @@ public class SchedularWritePlatformServiceJpaRepositoryImpl implements Schedular
boolean isStopExecution = false; boolean isStopExecution = false;
final ScheduledJobDetail scheduledJobDetail = this.scheduledJobDetailsRepository.findByJobKeyWithLock(jobKey); final ScheduledJobDetail scheduledJobDetail = this.scheduledJobDetailsRepository.findByJobKeyWithLock(jobKey);
if (scheduledJobDetail.isCurrentlyRunning() if (scheduledJobDetail.isCurrentlyRunning()
|| triggerType.equals(SchedulerServiceConstants.TRIGGER_TYPE_CRON) && scheduledJobDetail.getNextRunTime().after(new Date())) { || (triggerType.equals(SchedulerServiceConstants.TRIGGER_TYPE_CRON) && scheduledJobDetail.getNextRunTime().after(new Date()))) {
isStopExecution = true; isStopExecution = true;
} }
final SchedulerDetail schedulerDetail = retriveSchedulerDetail(); final SchedulerDetail schedulerDetail = retriveSchedulerDetail();
@@ -172,8 +172,8 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
String pathURL = request.getRequestURI(); String pathURL = request.getRequestURI();
boolean isSelfServiceRequest = pathURL != null && pathURL.contains("/self/"); boolean isSelfServiceRequest = pathURL != null && pathURL.contains("/self/");
boolean notAllowed = isSelfServiceRequest && !user.isSelfServiceUser() boolean notAllowed = (isSelfServiceRequest && !user.isSelfServiceUser())
|| !isSelfServiceRequest && user.isSelfServiceUser(); || (!isSelfServiceRequest && user.isSelfServiceUser());
if(notAllowed){ if(notAllowed){
throw new BadCredentialsException("User not authorised to use the requested resource."); throw new BadCredentialsException("User not authorised to use the requested resource.");
@@ -164,8 +164,8 @@ public final class StaffCommandFromApiJsonDeserializer {
//Need to add here check to see if any clients, group, account and loans are assigned to this staff if staff is being set to inactive --LJB //Need to add here check to see if any clients, group, account and loans are assigned to this staff if staff is being set to inactive --LJB
final Boolean forceStatus = this.fromApiJsonHelper.extractBooleanNamed("forceStatus", element); final Boolean forceStatus = this.fromApiJsonHelper.extractBooleanNamed("forceStatus", element);
if (!activeFlag && forceStatus == null || if ((!activeFlag && forceStatus == null) ||
!activeFlag && forceStatus) { (!activeFlag && forceStatus)) {
Object[] result = staffReadPlatformService.hasAssociatedItems(staffId); Object[] result = staffReadPlatformService.hasAssociatedItems(staffId);
if (result != null && result.length > 0) { if (result != null && result.length > 0) {
@@ -74,7 +74,7 @@ public class StandingInstructionHistoryReadPlatformServiceImpl implements Standi
sqlBuilder.append(this.standingInstructionHistoryMapper.schema()); sqlBuilder.append(this.standingInstructionHistoryMapper.schema());
if (standingInstructionDTO.transferType() != null || standingInstructionDTO.clientId() != null if (standingInstructionDTO.transferType() != null || standingInstructionDTO.clientId() != null
|| standingInstructionDTO.clientName() != null || standingInstructionDTO.clientName() != null
|| standingInstructionDTO.fromAccountType() != null && standingInstructionDTO.fromAccount() != null || (standingInstructionDTO.fromAccountType() != null && standingInstructionDTO.fromAccount() != null)
|| standingInstructionDTO.startDateRange() != null || standingInstructionDTO.endDateRange() != null) { || standingInstructionDTO.startDateRange() != null || standingInstructionDTO.endDateRange() != null) {
sqlBuilder.append(" where "); sqlBuilder.append(" where ");
} }
@@ -222,7 +222,7 @@ public class StandingInstructionWritePlatformServiceImpl implements StandingInst
} }
BigDecimal transactionAmount = data.amount(); BigDecimal transactionAmount = data.amount();
if (data.toAccountType().isLoanAccount() if (data.toAccountType().isLoanAccount()
&& (recurrenceType.isDuesRecurrence() || isDueForTransfer && instructionType.isDuesAmoutTransfer())) { && (recurrenceType.isDuesRecurrence() || (isDueForTransfer && instructionType.isDuesAmoutTransfer()))) {
StandingInstructionDuesData standingInstructionDuesData = this.standingInstructionReadPlatformService StandingInstructionDuesData standingInstructionDuesData = this.standingInstructionReadPlatformService
.retriveLoanDuesData(data.toAccount().accountId()); .retriveLoanDuesData(data.toAccount().accountId());
if (data.instructionType().isDuesAmoutTransfer()) { if (data.instructionType().isDuesAmoutTransfer()) {
@@ -1266,8 +1266,8 @@ public class Loan extends AbstractPersistableCustom {
if (installment.getFeeChargesCharged(getCurrency()).isLessThan(fee) if (installment.getFeeChargesCharged(getCurrency()).isLessThan(fee)
|| installment.getInterestCharged(getCurrency()).isLessThan(interest) || installment.getInterestCharged(getCurrency()).isLessThan(interest)
|| installment.getPenaltyChargesCharged(getCurrency()).isLessThan(penality) || installment.getPenaltyChargesCharged(getCurrency()).isLessThan(penality)
|| getAccruedTill().isEqual(loanTransaction.getTransactionDate()) && !installment.getDueDate().isEqual( || (getAccruedTill().isEqual(loanTransaction.getTransactionDate()) && !installment.getDueDate().isEqual(
getAccruedTill())) { getAccruedTill()))) {
interest = interest.minus(loanTransaction.getInterestPortion(getCurrency())); interest = interest.minus(loanTransaction.getInterestPortion(getCurrency()));
fee = fee.minus(loanTransaction.getFeeChargesPortion(getCurrency())); fee = fee.minus(loanTransaction.getFeeChargesPortion(getCurrency()));
penality = penality.minus(loanTransaction.getPenaltyChargesPortion(getCurrency())); penality = penality.minus(loanTransaction.getPenaltyChargesPortion(getCurrency()));
@@ -2384,7 +2384,7 @@ public class Loan extends AbstractPersistableCustom {
**/ **/
if (isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct() if (isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct()
&& (isMultiDisburmentLoan() && getDisbursedLoanDisbursementDetails().size() == 1 || !isMultiDisburmentLoan())) { && ((isMultiDisburmentLoan() && getDisbursedLoanDisbursementDetails().size() == 1) || !isMultiDisburmentLoan())) {
final LoanTransaction interestAppliedTransaction = LoanTransaction.accrueInterest(getOffice(), this, interestApplied, final LoanTransaction interestAppliedTransaction = LoanTransaction.accrueInterest(getOffice(), this, interestApplied,
actualDisbursementDate, createdDate, currentUser); actualDisbursementDate, createdDate, currentUser);
addLoanTransaction(interestAppliedTransaction) ; addLoanTransaction(interestAppliedTransaction) ;
@@ -2733,12 +2733,12 @@ public class Loan extends AbstractPersistableCustom {
final Integer installmentNumber = null; final Integer installmentNumber = null;
for (final LoanCharge charge : charges()) { for (final LoanCharge charge : charges()) {
Date actualDisbursementDate = getActualDisbursementDate(charge); Date actualDisbursementDate = getActualDisbursementDate(charge);
if (charge.getCharge().getChargeTimeType().equals(ChargeTimeType.DISBURSEMENT.getValue()) if ((charge.getCharge().getChargeTimeType().equals(ChargeTimeType.DISBURSEMENT.getValue())
&& disbursedOn.equals(new LocalDate(actualDisbursementDate)) && actualDisbursementDate != null && !charge.isWaived() && !charge && disbursedOn.equals(new LocalDate(actualDisbursementDate)) && (actualDisbursementDate != null) && !charge.isWaived() && !charge
.isFullyPaid() .isFullyPaid())
|| charge.getCharge().getChargeTimeType().equals(ChargeTimeType.TRANCHE_DISBURSEMENT.getValue()) || (charge.getCharge().getChargeTimeType().equals(ChargeTimeType.TRANCHE_DISBURSEMENT.getValue())
&& disbursedOn.equals(new LocalDate(actualDisbursementDate)) && actualDisbursementDate != null && disbursedOn.equals(new LocalDate(actualDisbursementDate)) && (actualDisbursementDate != null)
&& !charge.isWaived() && !charge.isFullyPaid()) { && !charge.isWaived() && !charge.isFullyPaid())) {
if (totalFeeChargesDueAtDisbursement.isGreaterThanZero() && !charge.getChargePaymentMode().isPaymentModeAccountTransfer()) { if (totalFeeChargesDueAtDisbursement.isGreaterThanZero() && !charge.getChargePaymentMode().isPaymentModeAccountTransfer()) {
charge.markAsFullyPaid(); charge.markAsFullyPaid();
// Add "Loan Charge Paid By" details to this transaction // Add "Loan Charge Paid By" details to this transaction
@@ -4525,7 +4525,7 @@ public class Loan extends AbstractPersistableCustom {
} }
if (oldDueDate.equals(holiday.getFromDateLocalDate()) || oldDueDate.equals(holiday.getToDateLocalDate()) if (oldDueDate.equals(holiday.getFromDateLocalDate()) || oldDueDate.equals(holiday.getToDateLocalDate())
|| oldDueDate.isAfter(holiday.getFromDateLocalDate()) && oldDueDate.isBefore(holiday.getToDateLocalDate())) { || (oldDueDate.isAfter(holiday.getFromDateLocalDate()) && oldDueDate.isBefore(holiday.getToDateLocalDate()))) {
// FIXME: AA do we need to apply non-working days. // FIXME: AA do we need to apply non-working days.
// Assuming holiday's repayment reschedule to date cannot be // Assuming holiday's repayment reschedule to date cannot be
// created on a non-working day. // created on a non-working day.
@@ -4856,8 +4856,8 @@ public class Loan extends AbstractPersistableCustom {
} }
break; break;
case LOAN_DISBURSED: case LOAN_DISBURSED:
if (!(isApproved() && isNotDisbursed()) && !this.loanProduct.isMultiDisburseLoan() if ((!(isApproved() && isNotDisbursed()) && !this.loanProduct.isMultiDisburseLoan())
|| this.loanProduct.isMultiDisburseLoan() && !isAllTranchesNotDisbursed()) { || (this.loanProduct.isMultiDisburseLoan() && !isAllTranchesNotDisbursed())) {
final String defaultUserMessage = "Loan Disbursal is not allowed. Loan Account is not in approved and not disbursed state."; final String defaultUserMessage = "Loan Disbursal is not allowed. Loan Account is not in approved and not disbursed state.";
final ApiParameterError error = ApiParameterError.generalError( final ApiParameterError error = ApiParameterError.generalError(
"error.msg.loan.disbursal.account.is.not.approve.not.disbursed.state", defaultUserMessage); "error.msg.loan.disbursal.account.is.not.approve.not.disbursed.state", defaultUserMessage);
@@ -6020,10 +6020,10 @@ public class Loan extends AbstractPersistableCustom {
updateLoanToLastDisbursalState(actualDisbursementDate); updateLoanToLastDisbursalState(actualDisbursementDate);
for (Iterator<LoanTermVariations> iterator = this.loanTermVariations.iterator(); iterator.hasNext();) { for (Iterator<LoanTermVariations> iterator = this.loanTermVariations.iterator(); iterator.hasNext();) {
LoanTermVariations loanTermVariations = iterator.next(); LoanTermVariations loanTermVariations = iterator.next();
if (loanTermVariations.getTermType().isDueDateVariation() if ((loanTermVariations.getTermType().isDueDateVariation()
&& loanTermVariations.fetchDateValue().isAfter(actualDisbursementDate) && loanTermVariations.fetchDateValue().isAfter(actualDisbursementDate))
|| loanTermVariations.getTermType().isEMIAmountVariation() || (loanTermVariations.getTermType().isEMIAmountVariation()
&& loanTermVariations.getTermApplicableFrom().equals(actualDisbursementDate.toDate()) && loanTermVariations.getTermApplicableFrom().equals(actualDisbursementDate.toDate()))
|| loanTermVariations.getTermApplicableFrom().after(actualDisbursementDate.toDate())) { || loanTermVariations.getTermApplicableFrom().after(actualDisbursementDate.toDate())) {
iterator.remove(); iterator.remove();
} }
@@ -6138,8 +6138,8 @@ public class Loan extends AbstractPersistableCustom {
List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments() ; List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments() ;
for (final LoanRepaymentScheduleInstallment installment : installments) { for (final LoanRepaymentScheduleInstallment installment : installments) {
if (installment.getDueDate().isEqual(loanDisbursementDetail.expectedDisbursementDateAsLocalDate()) if (installment.getDueDate().isEqual(loanDisbursementDetail.expectedDisbursementDateAsLocalDate())
|| installment.getDueDate().isAfter(loanDisbursementDetail.expectedDisbursementDateAsLocalDate()) || (installment.getDueDate().isAfter(loanDisbursementDetail.expectedDisbursementDateAsLocalDate())
&& installment.isNotFullyPaidOff()) { && installment.isNotFullyPaidOff())) {
nextRepaymentDate = installment.getDueDate(); nextRepaymentDate = installment.getDueDate();
break; break;
} }
@@ -6384,9 +6384,9 @@ public class Loan extends AbstractPersistableCustom {
double interest = calculateInterestForDays(daysInPeriod, installment.getInterestCharged(getCurrency()).getAmount(), double interest = calculateInterestForDays(daysInPeriod, installment.getInterestCharged(getCurrency()).getAmount(),
tillDays); tillDays);
actualAmountTobeAccrued = actualAmountTobeAccrued.plus(interest); actualAmountTobeAccrued = actualAmountTobeAccrued.plus(interest);
} else if (tillDate.isAfter(installment.getFromDate()) && tillDate.isEqual(installment.getDueDate()) } else if ((tillDate.isAfter(installment.getFromDate()) && tillDate.isEqual(installment.getDueDate()))
|| tillDate.isEqual(installment.getFromDate()) && tillDate.isEqual(installment.getDueDate()) || (tillDate.isEqual(installment.getFromDate()) && tillDate.isEqual(installment.getDueDate()))
|| tillDate.isAfter(installment.getFromDate()) && tillDate.isAfter(installment.getDueDate())) { || (tillDate.isAfter(installment.getFromDate()) && tillDate.isAfter(installment.getDueDate()))) {
actualAmountTobeAccrued = actualAmountTobeAccrued.plus(installment.getInterestAccrued(getCurrency())); actualAmountTobeAccrued = actualAmountTobeAccrued.plus(installment.getInterestAccrued(getCurrency()));
} }
} }
@@ -6478,12 +6478,12 @@ public class Loan extends AbstractPersistableCustom {
if (loanTransaction.isChargesWaiver()) { if (loanTransaction.isChargesWaiver()) {
for (LoanChargePaidBy chargePaidBy : loanTransaction for (LoanChargePaidBy chargePaidBy : loanTransaction
.getLoanChargesPaid()) { .getLoanChargesPaid()) {
if (chargePaidBy.getLoanCharge().isDueDateCharge() && chargePaidBy if ((chargePaidBy.getLoanCharge().isDueDateCharge() && chargePaidBy
.getLoanCharge().getDueLocalDate() .getLoanCharge().getDueLocalDate()
.isAfter(transactionDate) .isAfter(transactionDate))
|| chargePaidBy.getLoanCharge().isInstalmentFee() && chargePaidBy || (chargePaidBy.getLoanCharge().isInstalmentFee() && chargePaidBy
.getInstallmentNumber() != null && chargePaidBy .getInstallmentNumber() != null && chargePaidBy
.getInstallmentNumber() > installmentNumber) { .getInstallmentNumber() > installmentNumber)) {
loanTransaction.reverse(); loanTransaction.reverse();
} }
} }
@@ -615,8 +615,8 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen
installemntCharge = loanCharge; installemntCharge = loanCharge;
chargePerInstallment = paidLoanChargePerInstallment; chargePerInstallment = paidLoanChargePerInstallment;
} }
} else if (latestPaidCharge == null || loanCharge.isPaidOrPartiallyPaid(currency) } else if (latestPaidCharge == null || (loanCharge.isPaidOrPartiallyPaid(currency)
&& loanCharge.getDueLocalDate().isAfter(latestPaidCharge.getDueLocalDate())) { && loanCharge.getDueLocalDate().isAfter(latestPaidCharge.getDueLocalDate()))) {
latestPaidCharge = loanCharge; latestPaidCharge = loanCharge;
} }
} }
@@ -118,8 +118,8 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto
GuarantorFundingDetails fundingDetails = new GuarantorFundingDetails(accountAssociations, GuarantorFundingDetails fundingDetails = new GuarantorFundingDetails(accountAssociations,
GuarantorFundStatusType.ACTIVE.getValue(), guarantorCommand.getAmount()); GuarantorFundStatusType.ACTIVE.getValue(), guarantorCommand.getAmount());
guarantorFundingDetails.add(fundingDetails); guarantorFundingDetails.add(fundingDetails);
if (loan.isDisbursed() || loan.isApproved() if (loan.isDisbursed() || (loan.isApproved()
&& (loan.getGuaranteeAmount() != null || loan.loanProduct().isHoldGuaranteeFundsEnabled())) { && (loan.getGuaranteeAmount() != null || loan.loanProduct().isHoldGuaranteeFundsEnabled()))) {
this.guarantorDomainService.assignGuarantor(fundingDetails, LocalDate.now()); this.guarantorDomainService.assignGuarantor(fundingDetails, LocalDate.now());
loan.updateGuaranteeAmount(fundingDetails.getAmount()); loan.updateGuaranteeAmount(fundingDetails.getAmount());
} }
@@ -338,4 +338,4 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto
throw new PlatformDataIntegrityException("error.msg.guarantor.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.guarantor.unknown.data.integrity.issue",
"Unknown data integrity issue with resource Guarantor: " + realCause.getMessage()); "Unknown data integrity issue with resource Guarantor: " + realCause.getMessage());
} }
} }