You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ka...@apache.org on 2020/06/08 01:32:41 UTC
[fineract] 01/02: FINERACT-822 enable OperatorPrecedence error
This is an automated email from the ASF dual-hosted git repository.
kaze pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
commit d5af66123188d6eccae1c228456e0a0767b43c16
Author: percyashu <pe...@gmail.com>
AuthorDate: Sat Jun 6 19:41:47 2020 +0100
FINERACT-822 enable OperatorPrecedence error
---
fineract-provider/build.gradle | 2 +-
.../fineract/commands/domain/CommandWrapper.java | 8 ++--
.../domain/GlobalConfigurationProperty.java | 6 +--
...dularWritePlatformServiceJpaRepositoryImpl.java | 2 +-
.../TenantAwareBasicAuthenticationFilter.java | 4 +-
.../StaffCommandFromApiJsonDeserializer.java | 4 +-
...gInstructionHistoryReadPlatformServiceImpl.java | 2 +-
...tandingInstructionWritePlatformServiceImpl.java | 2 +-
.../portfolio/loanaccount/domain/Loan.java | 50 +++++++++++-----------
...tLoanRepaymentScheduleTransactionProcessor.java | 4 +-
...ntorWritePlatformServiceJpaRepositoryIImpl.java | 6 +--
11 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle
index df81880..8c75a99 100644
--- a/fineract-provider/build.gradle
+++ b/fineract-provider/build.gradle
@@ -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",
diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java
index a9cc534..128ef5b 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java
@@ -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;
}
-}
\ No newline at end of file
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationProperty.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationProperty.java
index 5a7e066..cdba567 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationProperty.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationProperty.java
@@ -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;
}
-}
\ No newline at end of file
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java
index c1092bc..4a9ee4c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java
@@ -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();
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TenantAwareBasicAuthenticationFilter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TenantAwareBasicAuthenticationFilter.java
index 59daec0..110e418 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TenantAwareBasicAuthenticationFilter.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TenantAwareBasicAuthenticationFilter.java
@@ -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.");
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java
index 93271f1..f88f290 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java
@@ -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) {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionHistoryReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionHistoryReadPlatformServiceImpl.java
index b162957..37cedba 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionHistoryReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionHistoryReadPlatformServiceImpl.java
@@ -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 ");
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java
index 97df209..eebc507 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java
@@ -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()) {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
index 5cae47e..9e04553 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
@@ -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();
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java
index 40ac8f1..95d59cc 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java
@@ -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;
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java
index 3c415d4..428ad56 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java
@@ -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());
}
-}
\ No newline at end of file
+}