FINERACT-1483: fix Sonar bugs with Blocker and Critical severity
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
2d2192ca17
commit
bd48a93e24
+2
@@ -315,6 +315,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public Map<String, Object> updateSavingsProductToGLAccountMapping(final Long savingsProductId, final JsonCommand command,
|
public Map<String, Object> updateSavingsProductToGLAccountMapping(final Long savingsProductId, final JsonCommand command,
|
||||||
final boolean accountingRuleChanged, final int accountingRuleTypeId, final DepositAccountType accountType) {
|
final boolean accountingRuleChanged, final int accountingRuleTypeId, final DepositAccountType accountType) {
|
||||||
/***
|
/***
|
||||||
@@ -346,6 +347,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public Map<String, Object> updateShareProductToGLAccountMapping(final Long shareProductId, final JsonCommand command,
|
public Map<String, Object> updateShareProductToGLAccountMapping(final Long shareProductId, final JsonCommand command,
|
||||||
final boolean accountingRuleChanged, final int accountingRuleTypeId) {
|
final boolean accountingRuleChanged, final int accountingRuleTypeId) {
|
||||||
/***
|
/***
|
||||||
|
|||||||
+3
-2
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.infrastructure.core.domain;
|
package org.apache.fineract.infrastructure.core.domain;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -196,8 +197,8 @@ public class FineractPlatformTenantConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String toProtocol(DataSource dataSource) {
|
public static String toProtocol(DataSource dataSource) {
|
||||||
try {
|
try (Connection connection = dataSource.getConnection()) {
|
||||||
String url = dataSource.getConnection().getMetaData().getURL();
|
String url = connection.getMetaData().getURL();
|
||||||
return url.substring(0, url.indexOf("://"));
|
return url.substring(0, url.indexOf("://"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ public final class HookData implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getTemplateName() {
|
public String getTemplateName() {
|
||||||
return this.name;
|
return this.templateName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -44,6 +44,7 @@ public class ClientRepositoryWrapper {
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
public Client findOneWithNotFoundDetection(final Long id) {
|
public Client findOneWithNotFoundDetection(final Long id) {
|
||||||
return this.findOneWithNotFoundDetection(id, false);
|
return this.findOneWithNotFoundDetection(id, false);
|
||||||
}
|
}
|
||||||
@@ -77,6 +78,7 @@ public class ClientRepositoryWrapper {
|
|||||||
this.repository.flush();
|
this.repository.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
public Client getActiveClientInUserScope(Long clientId) {
|
public Client getActiveClientInUserScope(Long clientId) {
|
||||||
final Client client = this.findOneWithNotFoundDetection(clientId);
|
final Client client = this.findOneWithNotFoundDetection(clientId);
|
||||||
if (client.isNotActive()) {
|
if (client.isNotActive()) {
|
||||||
|
|||||||
+1
@@ -44,6 +44,7 @@ public class LoanRepositoryWrapper {
|
|||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
public Loan findOneWithNotFoundDetection(final Long id) {
|
public Loan findOneWithNotFoundDetection(final Long id) {
|
||||||
return this.findOneWithNotFoundDetection(id, false);
|
return this.findOneWithNotFoundDetection(id, false);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -84,7 +84,7 @@ public class GuarantorReadPlatformServiceImpl implements GuarantorReadPlatformSe
|
|||||||
PreparedStatement preparedStatement = con.prepareStatement(finalSql, ResultSet.TYPE_SCROLL_SENSITIVE,
|
PreparedStatement preparedStatement = con.prepareStatement(finalSql, ResultSet.TYPE_SCROLL_SENSITIVE,
|
||||||
ResultSet.CONCUR_UPDATABLE);
|
ResultSet.CONCUR_UPDATABLE);
|
||||||
preparedStatement.setInt(1, AccountAssociationType.GUARANTOR_ACCOUNT_ASSOCIATION.getValue());
|
preparedStatement.setInt(1, AccountAssociationType.GUARANTOR_ACCOUNT_ASSOCIATION.getValue());
|
||||||
preparedStatement.setLong(2, loanId);
|
preparedStatement.setLong(2, loanId); // NOSONAR
|
||||||
return preparedStatement;
|
return preparedStatement;
|
||||||
}, rm);
|
}, rm);
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public class GuarantorReadPlatformServiceImpl implements GuarantorReadPlatformSe
|
|||||||
ResultSet.CONCUR_UPDATABLE);
|
ResultSet.CONCUR_UPDATABLE);
|
||||||
preparedStatement.setInt(1, AccountAssociationType.GUARANTOR_ACCOUNT_ASSOCIATION.getValue());
|
preparedStatement.setInt(1, AccountAssociationType.GUARANTOR_ACCOUNT_ASSOCIATION.getValue());
|
||||||
preparedStatement.setLong(2, loanId);
|
preparedStatement.setLong(2, loanId);
|
||||||
preparedStatement.setLong(3, guarantorId);
|
preparedStatement.setLong(3, guarantorId);// NOSONAR
|
||||||
return preparedStatement;
|
return preparedStatement;
|
||||||
}, rm).get(0);
|
}, rm).get(0);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1024,7 +1024,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Money totalInterestDueForLoan = Money.zero(loanApplicationTerms.getCurrency());
|
Money totalInterestDueForLoan = Money.zero(loanApplicationTerms.getCurrency());
|
||||||
loanApplicationTerms.setTotalPrincipalAccounted(scheduleParams.getTotalCumulativePrincipal());
|
loanApplicationTerms.setTotalPrincipalAccountedForInterestCalculation(scheduleParams.getTotalCumulativePrincipal());
|
||||||
totalInterestDueForLoan = loanApplicationTerms.calculateTotalInterestCharged(calculator, mc);
|
totalInterestDueForLoan = loanApplicationTerms.calculateTotalInterestCharged(calculator, mc);
|
||||||
totalInterestDueForLoan = totalInterestDueForLoan.plus(scheduleParams.getTotalCumulativeInterest());
|
totalInterestDueForLoan = totalInterestDueForLoan.plus(scheduleParams.getTotalCumulativeInterest());
|
||||||
loanApplicationTerms.updateTotalInterestDue(totalInterestDueForLoan);
|
loanApplicationTerms.updateTotalInterestDue(totalInterestDueForLoan);
|
||||||
@@ -1147,7 +1147,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
|||||||
if (loanApplicationTerms.getInterestMethod().isDecliningBalnce()) {
|
if (loanApplicationTerms.getInterestMethod().isDecliningBalnce()) {
|
||||||
adjustInstallmentOrPrincipalAmount(loanApplicationTerms, totalCumulativePrincipal, instalmentNumber, mc);
|
adjustInstallmentOrPrincipalAmount(loanApplicationTerms, totalCumulativePrincipal, instalmentNumber, mc);
|
||||||
} else {
|
} else {
|
||||||
loanApplicationTerms.setTotalPrincipalAccounted(totalCumulativePrincipal);
|
loanApplicationTerms.setTotalPrincipalAccountedForInterestCalculation(totalCumulativePrincipal);
|
||||||
loanApplicationTerms.updateExcludePeriodsForCalculation(instalmentNumber - 1);
|
loanApplicationTerms.updateExcludePeriodsForCalculation(instalmentNumber - 1);
|
||||||
}
|
}
|
||||||
variation.setProcessed(true);
|
variation.setProcessed(true);
|
||||||
|
|||||||
+1
-1
@@ -1773,7 +1773,7 @@ public final class LoanApplicationTerms {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTotalPrincipalAccounted(Money totalPrincipalAccounted) {
|
public void setTotalPrincipalAccountedForInterestCalculation(Money totalPrincipalAccounted) {
|
||||||
this.totalPrincipalAccountedForInterestCalcualtion = totalPrincipalAccounted;
|
this.totalPrincipalAccountedForInterestCalcualtion = totalPrincipalAccounted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
@@ -33,6 +33,7 @@ public class LoanRescheduleRequestRepositoryWrapper {
|
|||||||
this.loanRescheduleRequestRepository = loanRescheduleRequestRepository;
|
this.loanRescheduleRequestRepository = loanRescheduleRequestRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
public LoanRescheduleRequest findOneWithNotFoundDetection(final Long id) {
|
public LoanRescheduleRequest findOneWithNotFoundDetection(final Long id) {
|
||||||
return this.findOneWithNotFoundDetection(id, false);
|
return this.findOneWithNotFoundDetection(id, false);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -529,6 +529,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public CommandProcessingResult postInterest(final JsonCommand command) {
|
public CommandProcessingResult postInterest(final JsonCommand command) {
|
||||||
|
|
||||||
Long savingsId = command.getSavingsId();
|
Long savingsId = command.getSavingsId();
|
||||||
|
|||||||
+1
-1
@@ -137,7 +137,7 @@ public class RepaymentWithPostDatedChecksTest {
|
|||||||
// Repay for the installment 1 using post dated check
|
// Repay for the installment 1 using post dated check
|
||||||
HashMap postDatedCheck = this.loanTransactionHelper.getPostDatedCheck(loanID, Integer.valueOf(1));
|
HashMap postDatedCheck = this.loanTransactionHelper.getPostDatedCheck(loanID, Integer.valueOf(1));
|
||||||
Assertions.assertNotNull(postDatedCheck);
|
Assertions.assertNotNull(postDatedCheck);
|
||||||
Assertions.assertNotNull(Float.parseFloat(String.valueOf(postDatedCheck.get("amount"))));
|
Assertions.assertNotNull(Float.valueOf(String.valueOf(postDatedCheck.get("amount"))));
|
||||||
|
|
||||||
this.loanTransactionHelper.makeRepaymentWithPDC(LOAN_REPAYMENT_DATE, firstInstallmentAmount, loanID, paymentTypeId);
|
this.loanTransactionHelper.makeRepaymentWithPDC(LOAN_REPAYMENT_DATE, firstInstallmentAmount, loanID, paymentTypeId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user