fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vorbur...@apache.org
Subject [fineract] branch develop updated: FINERACT-822 enable ReferenceEquality error
Date Thu, 11 Jun 2020 20:32:47 GMT
This is an automated email from the ASF dual-hosted git repository.

vorburger 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 cd5fed5  FINERACT-822 enable ReferenceEquality error
cd5fed5 is described below

commit cd5fed5eda0827a431a0be92d1c95385ccf73e60
Author: percyashu <percyayukashu@gmail.com>
AuthorDate: Sat Jun 6 20:41:01 2020 +0100

    FINERACT-822 enable ReferenceEquality error
---
 fineract-provider/build.gradle                                      | 2 +-
 .../FlexibleSavingsInterestPostingIntegrationTest.java              | 2 +-
 .../integrationtests/common/loans/LoanApplicationTestBuilder.java   | 6 +++---
 .../bulkimport/importhandler/loan/LoanImportHandler.java            | 2 +-
 .../fineract/infrastructure/jobs/service/SchedulerJobListener.java  | 2 +-
 .../src/main/java/org/apache/fineract/mix/data/ContextData.java     | 2 +-
 .../interestratechart/domain/InterestRateChartSlabFields.java       | 5 +++--
 .../LoanApplicationWritePlatformServiceJpaRepositoryImpl.java       | 6 +++---
 8 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle
index 864f21d..87f8998 100644
--- a/fineract-provider/build.gradle
+++ b/fineract-provider/build.gradle
@@ -315,7 +315,6 @@ tasks.withType(JavaCompile) {
                 "ClassCanBeStatic",
                 "MixedMutabilityReturnType",
                 "SameNameButDifferent",
-                "ReferenceEquality",
                 "StringSplitter",
                 "MissingOverride",
                 "BigDecimalEquals",
@@ -369,6 +368,7 @@ tasks.withType(JavaCompile) {
                 "CompareToZero",
                 "NarrowingCompoundAssignment",
                 "MissingCasesInEnumSwitch",
+                "ReferenceEquality",
                 "OperatorPrecedence",
                 "EqualsGetClass",
                 "JdkObsolete",
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FlexibleSavingsInterestPostingIntegrationTest.java
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FlexibleSavingsInterestPostingIntegrationTest.java
index 81117ea..59324fb 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FlexibleSavingsInterestPostingIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/FlexibleSavingsInterestPostingIntegrationTest.java
@@ -122,7 +122,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
 
         Boolean enabled = (Boolean) globalConfig.get(10).get("enabled");
 
-        if (enabled != periodEndEnable) {
+        if (!enabled.equals(periodEndEnable)) {
             periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec,
                     this.responseSpec, periodEndConfigId.toString(), periodEndEnable);
         }
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanApplicationTestBuilder.java
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanApplicationTestBuilder.java
index 4f9515a..3001c61 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanApplicationTestBuilder.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/loans/LoanApplicationTestBuilder.java
@@ -80,14 +80,14 @@ public class LoanApplicationTestBuilder {
         final HashMap<String, Object> map = new HashMap<>();
         map.put("groupId", groupID);
         map.put("clientId", clientID);
-        if (this.loanType == "jlg") {
+        if ("jlg".equals(this.loanType)) {
             if (this.calendarId != null) {
                 map.put("calendarId", this.calendarId);
             }
             map.put("syncDisbursementWithMeeting", this.syncDisbursementWithMeeting);
         }
 
-        if (this.loanType == "glim") {
+        if ("glim".equals(this.loanType)) {
             if (isParentAccount!=null){
                 map.put("isParentAccount", this.isParentAccount);
             }
@@ -103,7 +103,7 @@ public class LoanApplicationTestBuilder {
 
         final HashMap<String, Object> map = new HashMap<>();
 
-        if (this.loanType == "group") {
+        if ("group".equals(this.loanType)) {
             map.put("groupId", ID);
         } else {
             map.put("clientId", ID);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java
index 71c6ea0..577bc90 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java
@@ -431,7 +431,7 @@ public class LoanImportHandler implements ImportHandler {
             String linkAccountId = disbusalData.getLinkAccountId();
             GsonBuilder gsonBuilder = new GsonBuilder();
             gsonBuilder.registerTypeAdapter(LocalDate.class, new DateSerializer(dateFormat));
-            if (linkAccountId != null && linkAccountId != "") {
+            if (linkAccountId != null && !"".equals(linkAccountId)) {
                 String payload =gsonBuilder.create().toJson(disbusalData);
                 final CommandWrapper commandRequest = new CommandWrapperBuilder() //
                         .disburseLoanToSavingsApplication(result.getLoanId()) //
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobListener.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobListener.java
index ffa5ed1..80b04bc 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobListener.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobListener.java
@@ -110,7 +110,7 @@ public class SchedulerJobListener implements JobListener {
         if (context.getMergedJobDataMap().containsKey(SchedulerServiceConstants.TRIGGER_TYPE_REFERENCE))
{
             triggerType = context.getMergedJobDataMap().getString(SchedulerServiceConstants.TRIGGER_TYPE_REFERENCE);
         }
-        if (triggerType == SchedulerServiceConstants.TRIGGER_TYPE_CRON && trigger.getNextFireTime()
!= null
+        if (SchedulerServiceConstants.TRIGGER_TYPE_CRON.equals(triggerType) && trigger.getNextFireTime()
!= null
                 && trigger.getNextFireTime().after(scheduledJobDetails.getNextRunTime()))
{
             scheduledJobDetails.updateNextRunTime(trigger.getNextFireTime());
         }
diff --git a/fineract-provider/src/main/java/org/apache/fineract/mix/data/ContextData.java
b/fineract-provider/src/main/java/org/apache/fineract/mix/data/ContextData.java
index 8434be5..9a2f5fc 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/mix/data/ContextData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/mix/data/ContextData.java
@@ -27,7 +27,7 @@ public class ContextData {
     public ContextData(final String dimensionType, final String dimension, final Integer
taxonomyType) {
         this.dimensionType = dimensionType;
         this.dimension = dimension;
-        this.periodType = taxonomyType == MixTaxonomyData.BALANCESHEET || taxonomyType ==
MixTaxonomyData.PORTFOLIO ? 0 : 1;
+        this.periodType = taxonomyType.equals(MixTaxonomyData.BALANCESHEET) || taxonomyType.equals(MixTaxonomyData.PORTFOLIO)
? 0 : 1;
     }
 
     public String getDimensionType() {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java
index 1e1bacc..7c21794 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java
@@ -29,6 +29,7 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartS
 import java.math.BigDecimal;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 import javax.persistence.Column;
 import javax.persistence.Embeddable;
 import org.apache.fineract.infrastructure.core.api.JsonCommand;
@@ -295,7 +296,7 @@ public class InterestRateChartSlabFields {
 
     public boolean isIntegerSame(final Integer obj1, final Integer obj2) {
         if (obj1 == null || obj2 == null) {
-            if (obj1 == obj2) { return true; }
+            if (Objects.equals(obj1, obj2)) { return true; }
             return false;
         }
         return obj1.equals(obj2);
@@ -303,7 +304,7 @@ public class InterestRateChartSlabFields {
 
     public boolean isBigDecimalSame(final BigDecimal obj1, final BigDecimal obj2) {
         if (obj1 == null || obj2 == null) {
-            if (obj1 == obj2) { return true; }
+            if (Objects.equals(obj1, obj2)) { return true; }
             return false;
         }
         return obj1.compareTo(obj2) == 0;
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
index ac82ee7..da71211 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
@@ -903,7 +903,7 @@ public void checkForProductMixRestrictions(final Loan loan) {
                     final Long loanIdToClose = command.longValueOfParameterNamed(LoanApiConstants.loanIdToClose);
                     LoanTopupDetails existingLoanTopupDetails = existingLoanApplication.getTopupLoanDetails();
                     if(existingLoanTopupDetails == null
-                            || (existingLoanTopupDetails != null && existingLoanTopupDetails.getLoanIdToClose()
!= loanIdToClose)
+                            || (existingLoanTopupDetails != null && !existingLoanTopupDetails.getLoanIdToClose().equals(loanIdToClose))
                             || changes.containsKey("submittedOnDate")
                             || changes.containsKey("expectedDisbursementDate")
                             || changes.containsKey("principal")
@@ -947,7 +947,7 @@ public void checkForProductMixRestrictions(final Loan loan) {
                                     "Topup loan amount should be greater than outstanding
amount of loan to be closed.");
                         }
 
-                        if(existingLoanIdToClose != loanIdToClose){
+                        if(!existingLoanIdToClose.equals(loanIdToClose)) {
                             final LoanTopupDetails topupDetails = new LoanTopupDetails(existingLoanApplication,
loanIdToClose);
                             existingLoanApplication.setTopupLoanDetails(topupDetails);
                             changes.put(LoanApiConstants.loanIdToClose, loanIdToClose);
@@ -1056,7 +1056,7 @@ public void checkForProductMixRestrictions(final Loan loan) {
                     if (isCalendarAssociatedWithEntity && calendarId == null) {
                         this.calendarRepository.delete(calendarInstance.getCalendar());
                     }
-                    if (calendarInstance.getCalendar().getId() != calendar.getId()) {
+                    if (!calendarInstance.getCalendar().getId().equals(calendar.getId()))
{
                         calendarInstance.updateCalendar(calendar);
                         this.calendarInstanceRepository.saveAndFlush(calendarInstance);
                     }


Mime
View raw message