FINERACT-822 enable ReferenceEquality error

This commit is contained in:
percyashu
2020-06-11 22:32:37 +02:00
committed by Michael Vorburger ⛑️
parent dae424da1a
commit cd5fed5eda
8 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -315,7 +315,6 @@ tasks.withType(JavaCompile) {
"ClassCanBeStatic", "ClassCanBeStatic",
"MixedMutabilityReturnType", "MixedMutabilityReturnType",
"SameNameButDifferent", "SameNameButDifferent",
"ReferenceEquality",
"StringSplitter", "StringSplitter",
"MissingOverride", "MissingOverride",
"BigDecimalEquals", "BigDecimalEquals",
@@ -369,6 +368,7 @@ tasks.withType(JavaCompile) {
"CompareToZero", "CompareToZero",
"NarrowingCompoundAssignment", "NarrowingCompoundAssignment",
"MissingCasesInEnumSwitch", "MissingCasesInEnumSwitch",
"ReferenceEquality",
"OperatorPrecedence", "OperatorPrecedence",
"EqualsGetClass", "EqualsGetClass",
"JdkObsolete", "JdkObsolete",
@@ -122,7 +122,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
Boolean enabled = (Boolean) globalConfig.get(10).get("enabled"); Boolean enabled = (Boolean) globalConfig.get(10).get("enabled");
if (enabled != periodEndEnable) { if (!enabled.equals(periodEndEnable)) {
periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec,
this.responseSpec, periodEndConfigId.toString(), periodEndEnable); this.responseSpec, periodEndConfigId.toString(), periodEndEnable);
} }
@@ -80,14 +80,14 @@ public class LoanApplicationTestBuilder {
final HashMap<String, Object> map = new HashMap<>(); final HashMap<String, Object> map = new HashMap<>();
map.put("groupId", groupID); map.put("groupId", groupID);
map.put("clientId", clientID); map.put("clientId", clientID);
if (this.loanType == "jlg") { if ("jlg".equals(this.loanType)) {
if (this.calendarId != null) { if (this.calendarId != null) {
map.put("calendarId", this.calendarId); map.put("calendarId", this.calendarId);
} }
map.put("syncDisbursementWithMeeting", this.syncDisbursementWithMeeting); map.put("syncDisbursementWithMeeting", this.syncDisbursementWithMeeting);
} }
if (this.loanType == "glim") { if ("glim".equals(this.loanType)) {
if (isParentAccount!=null){ if (isParentAccount!=null){
map.put("isParentAccount", this.isParentAccount); map.put("isParentAccount", this.isParentAccount);
} }
@@ -103,7 +103,7 @@ public class LoanApplicationTestBuilder {
final HashMap<String, Object> map = new HashMap<>(); final HashMap<String, Object> map = new HashMap<>();
if (this.loanType == "group") { if ("group".equals(this.loanType)) {
map.put("groupId", ID); map.put("groupId", ID);
} else { } else {
map.put("clientId", ID); map.put("clientId", ID);
@@ -431,7 +431,7 @@ public class LoanImportHandler implements ImportHandler {
String linkAccountId = disbusalData.getLinkAccountId(); String linkAccountId = disbusalData.getLinkAccountId();
GsonBuilder gsonBuilder = new GsonBuilder(); GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(LocalDate.class, new DateSerializer(dateFormat)); gsonBuilder.registerTypeAdapter(LocalDate.class, new DateSerializer(dateFormat));
if (linkAccountId != null && linkAccountId != "") { if (linkAccountId != null && !"".equals(linkAccountId)) {
String payload =gsonBuilder.create().toJson(disbusalData); String payload =gsonBuilder.create().toJson(disbusalData);
final CommandWrapper commandRequest = new CommandWrapperBuilder() // final CommandWrapper commandRequest = new CommandWrapperBuilder() //
.disburseLoanToSavingsApplication(result.getLoanId()) // .disburseLoanToSavingsApplication(result.getLoanId()) //
@@ -110,7 +110,7 @@ public class SchedulerJobListener implements JobListener {
if (context.getMergedJobDataMap().containsKey(SchedulerServiceConstants.TRIGGER_TYPE_REFERENCE)) { if (context.getMergedJobDataMap().containsKey(SchedulerServiceConstants.TRIGGER_TYPE_REFERENCE)) {
triggerType = context.getMergedJobDataMap().getString(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())) { && trigger.getNextFireTime().after(scheduledJobDetails.getNextRunTime())) {
scheduledJobDetails.updateNextRunTime(trigger.getNextFireTime()); scheduledJobDetails.updateNextRunTime(trigger.getNextFireTime());
} }
@@ -27,7 +27,7 @@ public class ContextData {
public ContextData(final String dimensionType, final String dimension, final Integer taxonomyType) { public ContextData(final String dimensionType, final String dimension, final Integer taxonomyType) {
this.dimensionType = dimensionType; this.dimensionType = dimensionType;
this.dimension = dimension; 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() { public String getDimensionType() {
@@ -29,6 +29,7 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartS
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Embeddable; import javax.persistence.Embeddable;
import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.api.JsonCommand;
@@ -295,7 +296,7 @@ public class InterestRateChartSlabFields {
public boolean isIntegerSame(final Integer obj1, final Integer obj2) { public boolean isIntegerSame(final Integer obj1, final Integer obj2) {
if (obj1 == null || obj2 == null) { if (obj1 == null || obj2 == null) {
if (obj1 == obj2) { return true; } if (Objects.equals(obj1, obj2)) { return true; }
return false; return false;
} }
return obj1.equals(obj2); return obj1.equals(obj2);
@@ -303,7 +304,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 (obj1 == obj2) { return true; } if (Objects.equals(obj1, obj2)) { return true; }
return false; return false;
} }
return obj1.compareTo(obj2) == 0; return obj1.compareTo(obj2) == 0;
@@ -903,7 +903,7 @@ public void checkForProductMixRestrictions(final Loan loan) {
final Long loanIdToClose = command.longValueOfParameterNamed(LoanApiConstants.loanIdToClose); final Long loanIdToClose = command.longValueOfParameterNamed(LoanApiConstants.loanIdToClose);
LoanTopupDetails existingLoanTopupDetails = existingLoanApplication.getTopupLoanDetails(); LoanTopupDetails existingLoanTopupDetails = existingLoanApplication.getTopupLoanDetails();
if(existingLoanTopupDetails == null if(existingLoanTopupDetails == null
|| (existingLoanTopupDetails != null && existingLoanTopupDetails.getLoanIdToClose() != loanIdToClose) || (existingLoanTopupDetails != null && !existingLoanTopupDetails.getLoanIdToClose().equals(loanIdToClose))
|| changes.containsKey("submittedOnDate") || changes.containsKey("submittedOnDate")
|| changes.containsKey("expectedDisbursementDate") || changes.containsKey("expectedDisbursementDate")
|| changes.containsKey("principal") || 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."); "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); final LoanTopupDetails topupDetails = new LoanTopupDetails(existingLoanApplication, loanIdToClose);
existingLoanApplication.setTopupLoanDetails(topupDetails); existingLoanApplication.setTopupLoanDetails(topupDetails);
changes.put(LoanApiConstants.loanIdToClose, loanIdToClose); changes.put(LoanApiConstants.loanIdToClose, loanIdToClose);
@@ -1056,7 +1056,7 @@ public void checkForProductMixRestrictions(final Loan loan) {
if (isCalendarAssociatedWithEntity && calendarId == null) { if (isCalendarAssociatedWithEntity && calendarId == null) {
this.calendarRepository.delete(calendarInstance.getCalendar()); this.calendarRepository.delete(calendarInstance.getCalendar());
} }
if (calendarInstance.getCalendar().getId() != calendar.getId()) { if (!calendarInstance.getCalendar().getId().equals(calendar.getId())) {
calendarInstance.updateCalendar(calendar); calendarInstance.updateCalendar(calendar);
this.calendarInstanceRepository.saveAndFlush(calendarInstance); this.calendarInstanceRepository.saveAndFlush(calendarInstance);
} }