FINERACT-1724: Sonar fixes
Fineract Docker build - MariaDB / build (push) Canceled after 0s
Fineract Docker build - PostgreSQL / build (push) Canceled after 0s
Fineract Kafka Smoke / build (push) Canceled after 0s
Fineract Documentation build / build (push) Canceled after 0s
Fineract Build & Test - MariaDB / build (push) Canceled after 0s
Fineract Build & Test - MySQL / build (push) Canceled after 0s
Fineract Build & Test - PostgreSQL / build (push) Canceled after 0s
Fineract ActiveMQ Smoke / build (push) Canceled after 0s

This commit is contained in:
abraham.menyhart
2023-08-10 12:56:45 +02:00
committed by Adam Saghy
parent 33c1aa7874
commit d6c10e8303
31 changed files with 113 additions and 276 deletions
@@ -22,7 +22,6 @@ import org.apache.fineract.cob.COBBusinessStepService;
import org.apache.fineract.cob.common.CustomJobParameterResolver;
import org.apache.fineract.cob.common.ResetContextTasklet;
import org.apache.fineract.cob.conditions.LoanCOBEnabledCondition;
import org.apache.fineract.cob.domain.LoanAccountLockRepository;
import org.apache.fineract.cob.listener.InlineCOBLoanItemListener;
import org.apache.fineract.infrastructure.jobs.domain.CustomJobParameterRepository;
import org.apache.fineract.infrastructure.jobs.service.JobName;
@@ -60,8 +59,6 @@ public class LoanInlineCOBConfig {
@Autowired
private COBBusinessStepService cobBusinessStepService;
@Autowired
private LoanAccountLockRepository accountLockRepository;
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private CustomJobParameterRepository customJobParameterRepository;
@@ -134,8 +134,9 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
tagIdCodeValueData = new CodeValueData().setId(tagId);
}
String description = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.DESCRIPTION_COL, row);
return GLAccountData.importInstance(accountName, parentId, glCode, manualEntriesAllowed, accountTypeEnum, usageEnum, description,
tagIdCodeValueData, row.getRowNum());
return new GLAccountData().setName(accountName).setParentId(parentId).setGlCode(glCode)
.setManualEntriesAllowed(manualEntriesAllowed).setType(accountTypeEnum).setUsage(usageEnum).setDescription(description)
.setTagId(tagIdCodeValueData).setRowIndex(row.getRowNum());
}
private Count importEntity(final Workbook workbook, final List<GLAccountData> glAccounts, final List<JournalEntryData> glTransactions,
@@ -1867,7 +1867,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
private void validateDatatable(final String datatable) {
final String sql = "SELECT COUNT(application_table_name) FROM x_registered_table WHERE registered_table_name = ?";
final Integer count = jdbcTemplate.queryForObject(sql, Integer.class, datatable);
final int count = jdbcTemplate.queryForObject(sql, Integer.class, datatable);
if (count == 0) {
throw new DatatableNotFoundException(datatable);
}
@@ -2278,7 +2278,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
builder.append(" JOIN m_entity_datatable_check edc ON edc.x_registered_table_name = xrt.registered_table_name");
builder.append(" WHERE edc.x_registered_table_name = '" + datatableName + "'");
final Long count = this.jdbcTemplate.queryForObject(builder.toString(), Long.class);
return count > 0 ? true : false;
return count > 0;
}
}
@@ -34,8 +34,8 @@ public class AmazonS3ConfigCondition extends PropertiesCondition {
}
private boolean isAwsCredentialValid() {
try {
DefaultCredentialsProvider.create().resolveCredentials();
try (var defaultCredentialsProvider = DefaultCredentialsProvider.create()) {
defaultCredentialsProvider.resolveCredentials();
DefaultAwsRegionProviderChain.builder().build().getRegion();
return true;
} catch (Exception e) {
@@ -133,7 +133,7 @@ public class TwoFactorConfigurationServiceImpl implements TwoFactorConfiguration
@Cacheable(value = "tfConfig", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()+'|smsProvider'")
public Integer getSMSProviderId() {
Integer value = getIntegerConfig(TwoFactorConfigurationConstants.SMS_PROVIDER_ID, null);
if (value < 1) {
if (value == null || value < 1) {
return null;
}
return value;
@@ -265,10 +265,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
+ " ci.entity_type_enum = ?";
try {
int calendarInstaneId = this.jdbcTemplate.queryForObject(query, Integer.class, entityId, calendarId, entityTypeId);
if (calendarInstaneId > 0) {
return true;
}
return false;
return calendarInstaneId > 0;
} catch (final EmptyResultDataAccessException e) {
return false;
}
@@ -202,7 +202,7 @@ public class DefaultScheduledDateGenerator implements ScheduledDateGenerator {
while (WorkingDaysUtil.isNonWorkingDay(holidayDetailDTO.getWorkingDays(), adjustedDateDetailsDTO.getChangedScheduleDate())) {
final RepaymentRescheduleType repaymentRescheduleType = WorkingDaysUtil
.getRepaymentRescheduleType(holidayDetailDTO.getWorkingDays(), adjustedDateDetailsDTO.getChangedScheduleDate());
.getRepaymentRescheduleType(holidayDetailDTO.getWorkingDays());
if (repaymentRescheduleType.isMoveToNextRepaymentDay()) {
while (WorkingDaysUtil.isNonWorkingDay(holidayDetailDTO.getWorkingDays(),
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.portfolio.loanaccount.service;
import static java.lang.Boolean.TRUE;
import static org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations.interestType;
import java.math.BigDecimal;
@@ -2153,7 +2154,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa
@Override
public boolean isGuaranteeRequired(final Long loanId) {
final String sql = "select pl.hold_guarantee_funds from m_loan ml inner join m_product_loan pl on pl.id = ml.product_id where ml.id=?";
return this.jdbcTemplate.queryForObject(sql, Boolean.class, loanId);
return TRUE.equals(this.jdbcTemplate.queryForObject(sql, Boolean.class, loanId));
}
private static final class LoanTransactionDerivedComponentMapper implements RowMapper<LoanTransactionData> {
@@ -27,7 +27,6 @@ import org.apache.fineract.portfolio.self.pockets.domain.PocketAccountMapping;
import org.apache.fineract.portfolio.self.pockets.domain.PocketAccountMappingRepositoryWrapper;
import org.apache.fineract.portfolio.self.pockets.domain.PocketRepositoryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@@ -77,11 +76,8 @@ public class PocketAccountMappingReadPlatformServiceImpl implements PocketAccoun
@Override
public boolean validatePocketAndAccountMapping(Long pocketId, Long accountId, Integer accountType) {
final String sql = "select count(id) from m_pocket_accounts_mapping mapping where pocket_id = ? and account_id = ? and account_type = ?";
try {
return this.jdbcTemplate.queryForObject(sql, Boolean.class, pocketId, accountId, accountType);
} catch (EmptyResultDataAccessException e) {
return false;
}
int count = this.jdbcTemplate.queryForObject(sql, Integer.class, pocketId, accountId, accountType);
return count > 0;
}
}
@@ -41,11 +41,8 @@ public class SelfServiceRegistrationReadPlatformServiceImpl implements SelfServi
sql = sql + " and mobile_no = ?";
params = new Object[] { accountNumber, firstName, lastName, mobileNumber };
}
Integer count = this.jdbcTemplate.queryForObject(sql, Integer.class, params);
if (count == 0) {
return false;
}
return true;
int count = this.jdbcTemplate.queryForObject(sql, Integer.class, params);
return count != 0;
}
}
@@ -218,10 +218,7 @@ public class AppUserReadPlatformServiceImpl implements AppUserReadPlatformServic
public boolean isUsernameExist(String username) {
String sql = "select count(*) from m_appuser where username = ?";
Object[] params = new Object[] { username };
Integer count = this.jdbcTemplate.queryForObject(sql, Integer.class, params);
if (count == 0) {
return false;
}
return true;
int count = this.jdbcTemplate.queryForObject(sql, Integer.class, params);
return count != 0;
}
}
@@ -158,6 +158,7 @@ fineract.report.export.s3.bucket=${FINERACT_REPORT_EXPORT_S3_BUCKET_NAME:}
fineract.report.export.s3.enabled=${FINERACT_REPORT_EXPORT_S3_ENABLED:false}
fineract.jpa.statementLoggingEnabled=${FINERACT_STATEMENT_LOGGING_ENABLED:false}
fineract.database.defaultMasterPassword=${FINERACT_DEFAULT_MASTER_PASSWORD:fineract}
fineract.notification.user-notification-system.enabled=${FINERACT_USER_NOTIFICATION_SYSTEM_ENABLED:true}
fineract.logging.json.enabled=${FINERACT_LOGGING_JSON_ENABLED:false}
@@ -86,6 +86,7 @@ fineract.report.export.s3.bucket=${FINERACT_REPORT_EXPORT_S3_BUCKET_NAME:}
fineract.report.export.s3.enabled=${FINERACT_REPORT_EXPORT_S3_ENABLED:false}
fineract.jpa.statementLoggingEnabled=${FINERACT_STATEMENT_LOGGING_ENABLED:false}
fineract.database.defaultMasterPassword=${FINERACT_DEFAULT_MASTER_PASSWORD:fineract}
fineract.job.loan-cob-enabled=${FINERACT_JOB_LOAN_COB_ENABLED:true}