[FINERACT-747] change String.replaceAll() to replace() to improve performance

This commit is contained in:
bd2019us
2019-04-13 19:52:58 -05:00
parent 8af4943427
commit f8c5de3e96
8 changed files with 15 additions and 15 deletions
@@ -48,10 +48,10 @@ public enum AccountingRuleJsonInputParams {
@Override
public String toString() {
return name().toString().replaceAll("_", " ");
return name().toString().replace("_", " ");
}
public String getValue() {
return this.value;
}
}
}
@@ -158,7 +158,7 @@ public class FixedDepositTransactionWorkbookPopulator extends AbstractWorkbookPo
//Account Number Named after Clients
for(int j = 0; j < clientsWithActiveSavings.size(); j++) {
Name name = savingsTransactionWorkbook.createName();
name.setNameName("Account_" + clientsWithActiveSavings.get(j).replaceAll(" ", "_") + "_" + clientIdsWithActiveSavings.get(j) + "_");
name.setNameName("Account_" + clientsWithActiveSavings.get(j).replace(" ", "_") + "_" + clientIdsWithActiveSavings.get(j) + "_");
name.setRefersToFormula(TemplatePopulateImportConstants.FIXED_DEPOSIT_TRANSACTION_SHEET_NAME+"!$Q$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[0] + ":$Q$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[1]);
}
@@ -199,7 +199,7 @@ public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
// Account Number Named after Clients
for (int j = 0; j < clientsWithActiveLoans.size(); j++) {
Name name = loanRepaymentWorkbook.createName();
name.setNameName("Account_" + clientsWithActiveLoans.get(j).replaceAll(" ", "_") + "_"
name.setNameName("Account_" + clientsWithActiveLoans.get(j).replace(" ", "_") + "_"
+ clientIdsWithActiveLoans.get(j) + "_");
name.setRefersToFormula(
TemplatePopulateImportConstants.LOAN_REPAYMENT_SHEET_NAME+"!$T$" + clientNameToBeginEndIndexes.get(clientsWithActiveLoans.get(j))[0] + ":$T$"
@@ -296,4 +296,4 @@ public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
}
}
}
@@ -163,7 +163,7 @@ public class SavingsTransactionsWorkbookPopulator extends AbstractWorkbookPopula
//Account Number Named after Clients
for(int j = 0; j < clientsWithActiveSavings.size(); j++) {
Name name = savingsTransactionWorkbook.createName();
name.setNameName("Account_" + clientsWithActiveSavings.get(j).replaceAll(" ", "_") + "_" + clientIdsWithActiveSavings.get(j) + "_");
name.setNameName("Account_" + clientsWithActiveSavings.get(j).replace(" ", "_") + "_" + clientIdsWithActiveSavings.get(j) + "_");
name.setRefersToFormula(TemplatePopulateImportConstants.SAVINGS_TRANSACTION_SHEET_NAME+"!$Q$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[0] + ":$Q$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[1]);
}
@@ -53,7 +53,7 @@ public enum ConditionType {
@Override
public String toString() {
return name().toString().replaceAll("_", " ");
return name().toString().replace("_", " ");
}
public Integer getValue() {
@@ -94,4 +94,4 @@ public enum ConditionType {
return values.toArray();
}
}
}
@@ -131,8 +131,8 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
String sqlQueryCriteria = searchCriteria.getSqlSearch();
if (StringUtils.isNotBlank(sqlQueryCriteria)) {
SQLInjectionValidator.validateSQLInput(sqlQueryCriteria);
sqlQueryCriteria = sqlQueryCriteria.replaceAll(" display_name ", " g.display_name ");
sqlQueryCriteria = sqlQueryCriteria.replaceAll("display_name ", "g.display_name ");
sqlQueryCriteria = sqlQueryCriteria.replace(" display_name ", " g.display_name ");
sqlQueryCriteria = sqlQueryCriteria.replace("display_name ", "g.display_name ");
extraCriteria.append(" and (").append(sqlQueryCriteria).append(") ");
this.columnValidator.validateSqlInjection(schemaSl, sqlQueryCriteria);
}
@@ -630,4 +630,4 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
"Validation errors exist.", dataValidationErrors); }
}
}
}
@@ -221,8 +221,8 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
String sqlSearch = searchCriteria.getSqlSearch();
if (sqlSearch != null) {
SQLInjectionValidator.validateSQLInput(sqlSearch);
sqlSearch = sqlSearch.replaceAll(" display_name ", " g.display_name ");
sqlSearch = sqlSearch.replaceAll("display_name ", "g.display_name ");
sqlSearch = sqlSearch.replace(" display_name ", " g.display_name ");
sqlSearch = sqlSearch.replace("display_name ", "g.display_name ");
extraCriteria.append(" and ( ").append(sqlSearch).append(") ");
this.columnValidator.validateSqlInjection(schemaSql, sqlSearch);
}
@@ -317,4 +317,4 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
return GroupGeneralData.withClosureReasons(closureReasons);
}
}
}
@@ -306,7 +306,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
String sqlQueryCriteria = searchParameters.getSqlSearch();
if (StringUtils.isNotBlank(sqlQueryCriteria)) {
SQLInjectionValidator.validateSQLInput(sqlQueryCriteria);
sqlQueryCriteria = sqlQueryCriteria.replaceAll("accountNo", "l.account_no");
sqlQueryCriteria = sqlQueryCriteria.replace("accountNo", "l.account_no");
this.columnValidator.validateSqlInjection(sqlBuilder.toString(), sqlQueryCriteria);
sqlBuilder.append(" and (").append(sqlQueryCriteria).append(")");
}