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