FINERACT-696

add spotbug bug-pattern plugin.

Apply suggestions from code review

closes https://issues.apache.org/jira/browse/FINERACT-696

Co-Authored-By: Michael Vorburger ⛑️ <mike@vorburger.ch>
This commit is contained in:
xurror
2020-03-13 09:27:34 +01:00
committed by Michael Vorburger ⛑️
co-authored by Michael Vorburger ⛑️
parent de329e2489
commit f484f884a0
86 changed files with 209 additions and 209 deletions
+6 -5
View File
@@ -39,14 +39,14 @@ buildscript {
'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0', 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0',
'org.zeroturnaround:gradle-jrebel-plugin:1.1.2', 'org.zeroturnaround:gradle-jrebel-plugin:1.1.2',
'org.springframework.boot:spring-boot-gradle-plugin:2.2.4.RELEASE' 'org.springframework.boot:spring-boot-gradle-plugin:2.2.4.RELEASE'
// below // below
classpath "org.apache.openjpa:openjpa:$openJPAVersion" classpath "org.apache.openjpa:openjpa:$openJPAVersion"
classpath 'com.radcortez.gradle:openjpa-gradle-plugin:3.1.0' classpath 'com.radcortez.gradle:openjpa-gradle-plugin:3.1.0'
classpath 'gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.2.2' classpath 'gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.2.2'
classpath "com.github.spotbugs:spotbugs-gradle-plugin:2.0.1" classpath "com.github.spotbugs:spotbugs-gradle-plugin:2.0.1"
// Use Guava version 23+ as a workaround to spotbug intergration. // Use Guava version 23+ as a workaround to spotbug intergration.
// See: https://github.com/spotbugs/spotbugs-gradle-plugin/issues/128#issuecomment-535864882 // See: https://github.com/spotbugs/spotbugs-gradle-plugin/issues/128#issuecomment-535864882
classpath 'com.google.guava:guava:28.1-jre' classpath 'com.google.guava:guava:28.1-jre'
} }
} }
@@ -103,6 +103,7 @@ dependencyManagement {
//dependency 'junit:junit-dep:4.11' //dependency 'junit:junit-dep:4.11'
dependency 'org.mockito:mockito-core:+' dependency 'org.mockito:mockito-core:+'
dependency 'com.jayway.restassured:rest-assured:2.3.3' dependency 'com.jayway.restassured:rest-assured:2.3.3'
dependency 'org.slf4j:slf4j-simple:1.7.30'
dependency 'com.mockrunner:mockrunner-jms:2.0.1' dependency 'com.mockrunner:mockrunner-jms:2.0.1'
dependency 'com.mockrunner:mockrunner-jdbc:2.0.1' dependency 'com.mockrunner:mockrunner-jdbc:2.0.1'
+3
View File
@@ -25,6 +25,8 @@ dependencies {
tomcat "org.apache.tomcat:tomcat-dbcp" tomcat "org.apache.tomcat:tomcat-dbcp"
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
spotbugsPlugins "jp.skypencil.findbugs.slf4j:bug-pattern:1.4.2@jar"
compile ("org.springframework.boot:spring-boot-starter-data-jpa") { compile ("org.springframework.boot:spring-boot-starter-data-jpa") {
exclude group: 'com.zaxxer', module: 'HikariCP' exclude group: 'com.zaxxer', module: 'HikariCP'
@@ -109,6 +111,7 @@ dependencies {
testCompile 'junit:junit', testCompile 'junit:junit',
//'junit:junit-dep', //'junit:junit-dep',
'org.mockito:mockito-core', 'org.mockito:mockito-core',
'org.slf4j:slf4j-simple',
'com.jayway.restassured:rest-assured', 'com.jayway.restassured:rest-assured',
'com.mockrunner:mockrunner-jms', 'com.mockrunner:mockrunner-jms',
'com.google.code.gson:gson', 'com.google.code.gson:gson',
@@ -26,6 +26,8 @@ dependencies {
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
spotbugsPlugins "jp.skypencil.findbugs.slf4j:bug-pattern:1.4.2@jar"
api( api(
'com.google.code.gson:gson', 'com.google.code.gson:gson',
'org.quartz-scheduler:quartz', 'org.quartz-scheduler:quartz',
@@ -109,6 +111,7 @@ dependencies {
testCompile 'junit:junit:4.11', testCompile 'junit:junit:4.11',
//'junit:junit-dep:4.11', //'junit:junit-dep:4.11',
'org.mockito:mockito-core', 'org.mockito:mockito-core',
'org.slf4j:slf4j-simple',
'com.jayway.restassured:rest-assured', 'com.jayway.restassured:rest-assured',
'com.mockrunner:mockrunner-jms', 'com.mockrunner:mockrunner-jms',
'com.google.code.gson:gson', 'com.google.code.gson:gson',
@@ -86,7 +86,7 @@ public class Utils {
sleep(3); sleep(3);
} }
} catch (Exception e) { } catch (Exception e) {
logger.info("{} caused {}, going to wait and retry (attempt {})", HEALTH_URL, new Object[] { e.getMessage(), attempt++ }); logger.info("{} caused {}, going to wait and retry (attempt {})", new Object[] { HEALTH_URL, e.getMessage(), attempt++ });
lastException = e; lastException = e;
sleep(3); sleep(3);
} }
@@ -96,7 +96,7 @@ public class Utils {
logger.error("{} still not reachable, giving up", HEALTH_URL, lastException); logger.error("{} still not reachable, giving up", HEALTH_URL, lastException);
throw new AssertionError(HEALTH_URL + " not reachable", lastException); throw new AssertionError(HEALTH_URL + " not reachable", lastException);
} else { } else {
logger.error("{} still has not returned HTTP 200, giving up; (last) body: ", HEALTH_URL, response.prettyPrint()); logger.error("{} still has not returned HTTP 200, giving up (last) body: {}", HEALTH_URL, response.prettyPrint());
fail(HEALTH_URL + " returned " + response.prettyPrint()); fail(HEALTH_URL + " returned " + response.prettyPrint());
} }
} }
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings({ "rawtypes" }) @SuppressWarnings({ "rawtypes" })
public class InteropHelper { public class InteropHelper {
private final static Logger log = LoggerFactory.getLogger(InteropTest.class); private final static Logger log = LoggerFactory.getLogger(InteropHelper.class);
private static final String BASE_URL = "/fineract-provider/api/v1/interoperation"; private static final String BASE_URL = "/fineract-provider/api/v1/interoperation";
private static final String HEALTH_URL = BASE_URL + "/health"; private static final String HEALTH_URL = BASE_URL + "/health";
@@ -135,10 +135,10 @@ public class InteropHelper {
*/ */
public String getHealth() { public String getHealth() {
String url = buildUrl(HEALTH_URL); String url = buildUrl(HEALTH_URL);
log.debug("Calling Interoperable GET Health: " + url); log.debug("Calling Interoperable GET Health: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null); String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Health: " + response); log.debug("Response Interoperable GET Health: {}", response);
return response; return response;
} }
@@ -147,10 +147,10 @@ public class InteropHelper {
*/ */
public String getParty(InteropIdentifierType idType, String idValue) { public String getParty(InteropIdentifierType idType, String idValue) {
String url = buildUrl(PARTIES_URL + '/' + idType + '/' + idValue); String url = buildUrl(PARTIES_URL + '/' + idType + '/' + idValue);
log.debug("Calling Interoperable GET Party: " + url); log.debug("Calling Interoperable GET Party: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null); String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Party: " + response); log.debug("Response Interoperable GET Party: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_ACCOUNT_ID); return getJsonAttribute(response, InteropUtil.PARAM_ACCOUNT_ID);
} }
@@ -160,10 +160,10 @@ public class InteropHelper {
public String postParty(InteropIdentifierType idType, String idValue) { public String postParty(InteropIdentifierType idType, String idValue) {
String url = buildUrl(PARTIES_URL + '/' + idType + '/' + idValue); String url = buildUrl(PARTIES_URL + '/' + idType + '/' + idValue);
String request = buildPartiesJson(); String request = buildPartiesJson();
log.debug("Calling Interoperable POST Party: " + url + ", body: " + request); log.debug("Calling Interoperable POST Party: {}, body: {}", url, request);
String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null); String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable POST Party: " + response); log.debug("Response Interoperable POST Party: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_ACCOUNT_ID); return getJsonAttribute(response, InteropUtil.PARAM_ACCOUNT_ID);
} }
@@ -173,10 +173,10 @@ public class InteropHelper {
public String deleteParty(InteropIdentifierType idType, String idValue) { public String deleteParty(InteropIdentifierType idType, String idValue) {
String url = buildUrl(PARTIES_URL + '/' + idType + '/' + idValue); String url = buildUrl(PARTIES_URL + '/' + idType + '/' + idValue);
String request = buildPartiesJson(); String request = buildPartiesJson();
log.debug("Calling Interoperable DELETE Party: " + url + ", body: " + request); log.debug("Calling Interoperable DELETE Party: {}, body: {}", url, request);
String response = Utils.performServerDelete(requestSpec, responseSpec, url, request, null); String response = Utils.performServerDelete(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable DELETE Party: " + response); log.debug("Response Interoperable DELETE Party: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_ACCOUNT_ID); return getJsonAttribute(response, InteropUtil.PARAM_ACCOUNT_ID);
} }
@@ -191,10 +191,10 @@ public class InteropHelper {
*/ */
public String getTransactionRequest(String requestCode) { public String getTransactionRequest(String requestCode) {
String url = buildUrl(TRANSACTIONS_URL + '/' + transactionCode + '/' + REQUESTS_URL_PARAM + '/' + requestCode); String url = buildUrl(TRANSACTIONS_URL + '/' + transactionCode + '/' + REQUESTS_URL_PARAM + '/' + requestCode);
log.debug("Calling Interoperable GET Request: " + url); log.debug("Calling Interoperable GET Request: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null); String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Request: " + response); log.debug("Response Interoperable GET Request: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_REQUEST_CODE); return getJsonAttribute(response, InteropUtil.PARAM_REQUEST_CODE);
} }
@@ -205,10 +205,10 @@ public class InteropHelper {
public String postTransactionRequest(String requestCode, InteropTransactionRole role) { public String postTransactionRequest(String requestCode, InteropTransactionRole role) {
String url = buildUrl(REQUESTS_URL); String url = buildUrl(REQUESTS_URL);
String request = buildTransactionRequestJson(requestCode, role); String request = buildTransactionRequestJson(requestCode, role);
log.debug("Calling Interoperable POST Request: " + url + ", body: " + request); log.debug("Calling Interoperable POST Request: {}, body: {}", url, request);
String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null); String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable POST Request: " + response); log.debug("Response Interoperable POST Request: {}", response);
return response; return response;
} }
@@ -238,10 +238,10 @@ public class InteropHelper {
*/ */
public String getQuote(String quoteCode) { public String getQuote(String quoteCode) {
String url = buildUrl(TRANSACTIONS_URL + '/' + transactionCode + '/' + QUOTES_URL_PARAM + '/' + quoteCode); String url = buildUrl(TRANSACTIONS_URL + '/' + transactionCode + '/' + QUOTES_URL_PARAM + '/' + quoteCode);
log.debug("Calling Interoperable GET Quote: " + url); log.debug("Calling Interoperable GET Quote: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null); String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Quote: " + response); log.debug("Response Interoperable GET Quote: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_QUOTE_CODE); return getJsonAttribute(response, InteropUtil.PARAM_QUOTE_CODE);
} }
@@ -251,10 +251,10 @@ public class InteropHelper {
public String postQuote(String quoteCode, InteropTransactionRole role) { public String postQuote(String quoteCode, InteropTransactionRole role) {
String url = buildUrl(QUOTES_URL); String url = buildUrl(QUOTES_URL);
String request = buildQuoteJson(quoteCode, role); String request = buildQuoteJson(quoteCode, role);
log.debug("Calling Interoperable POST Quote: " + url + ", body: " + request); log.debug("Calling Interoperable POST Quote: {}, body: {}", url, request);
String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null); String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable POST Quote: " + response); log.debug("Response Interoperable POST Quote: {}", response);
return response; return response;
} }
@@ -286,10 +286,10 @@ public class InteropHelper {
*/ */
public String getTransfer(String transferCode) { public String getTransfer(String transferCode) {
String url = buildUrl(TRANSACTIONS_URL + '/' + transactionCode + '/' + TRANSFERS_URL_PARAM + '/' + transferCode); String url = buildUrl(TRANSACTIONS_URL + '/' + transactionCode + '/' + TRANSFERS_URL_PARAM + '/' + transferCode);
log.debug("Calling Interoperable GET Transfer: " + url); log.debug("Calling Interoperable GET Transfer: {}", url);
String response = Utils.performServerGet(requestSpec, responseSpec, url, null); String response = Utils.performServerGet(requestSpec, responseSpec, url, null);
log.debug("Response Interoperable GET Transfer: " + response); log.debug("Response Interoperable GET Transfer: {}", response);
return getJsonAttribute(response, InteropUtil.PARAM_TRANSFER_CODE); return getJsonAttribute(response, InteropUtil.PARAM_TRANSFER_CODE);
} }
@@ -313,10 +313,10 @@ public class InteropHelper {
public String postTransfer(String transferCode, InteropTransferActionType action, InteropTransactionRole role) { public String postTransfer(String transferCode, InteropTransferActionType action, InteropTransactionRole role) {
String url = buildUrl(TRANSFERS_URL) + '&' + PARAM_TRANSFER_ACTION + '=' + action; String url = buildUrl(TRANSFERS_URL) + '&' + PARAM_TRANSFER_ACTION + '=' + action;
String request = buildTransferJson(transferCode, role); String request = buildTransferJson(transferCode, role);
log.debug("Calling Interoperable POST Transfer: " + url + ", body: " + request); log.debug("Calling Interoperable POST Transfer: {}, body: {}", url, request);
String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null); String response = Utils.performServerPost(requestSpec, responseSpec, url, request, null);
log.debug("Response Interoperable POST Transfer: " + response); log.debug("Response Interoperable POST Transfer: {}", response);
return response; return response;
} }
@@ -140,7 +140,7 @@ public class InteropTest {
savingsProductId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec); savingsProductId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
Assert.assertNotNull(savingsProductId); Assert.assertNotNull(savingsProductId);
log.debug("Sucessfully created Interoperable Saving Product (id: " + savingsProductId + ")"); log.debug("Sucessfully created Interoperable Saving Product (id: {})", savingsProductId);
} }
private void createCharge() { private void createCharge() {
@@ -167,7 +167,7 @@ public class InteropTest {
savingsAccountHelper.addChargesForSavings(savingsId, chargeId, false, interopHelper.getFee()); savingsAccountHelper.addChargesForSavings(savingsId, chargeId, false, interopHelper.getFee());
} }
log.debug("Sucessfully created Interoperable Saving Account (id: " + savingsId + ")"); log.debug("Sucessfully created Interoperable Saving Account (id: {})", savingsId);
} }
private void testParties() { private void testParties() {
@@ -245,7 +245,7 @@ public class InteropTest {
// prepare // prepare
savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null); savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null);
log.debug("Response Interoperable GET Saving: " + savings); log.debug("Response Interoperable GET Saving: {}", savings);
savingsJson = JsonPath.from(savings); savingsJson = JsonPath.from(savings);
BigDecimal onHold2 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class); BigDecimal onHold2 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class);
BigDecimal balance2 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class); BigDecimal balance2 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class);
@@ -263,7 +263,7 @@ public class InteropTest {
Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE));
savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null); savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null);
log.debug("Response Interoperable GET Saving: " + savings); log.debug("Response Interoperable GET Saving: {}", savings);
savingsJson = JsonPath.from(savings); savingsJson = JsonPath.from(savings);
BigDecimal onHold3 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class); BigDecimal onHold3 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class);
BigDecimal balance3 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class); BigDecimal balance3 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class);
@@ -277,7 +277,7 @@ public class InteropTest {
Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE)); Assert.assertEquals(InteropActionState.ACCEPTED.toString(), json.getString(InteropHelper.PARAM_ACTION_STATE));
savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null); savings = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, null);
log.debug("Response Interoperable GET Saving: " + savings); log.debug("Response Interoperable GET Saving: {}", savings);
savingsJson = JsonPath.from(savings); savingsJson = JsonPath.from(savings);
BigDecimal onHold4 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class); BigDecimal onHold4 = ObjectConverter.convertObjectTo(savingsJson.get(SavingsApiConstants.savingsAmountOnHold), BigDecimal.class);
BigDecimal balance4 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class); BigDecimal balance4 = ObjectConverter.convertObjectTo(savingsJson.get(PARAM_ACCOUNT_BALANCE), BigDecimal.class);
@@ -144,7 +144,7 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure
command.longValueOfParameterNamed(GLClosureJsonInputParams.OFFICE_ID.getValue()), new LocalDate( command.longValueOfParameterNamed(GLClosureJsonInputParams.OFFICE_ID.getValue()), new LocalDate(
command.DateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue()))); } command.DateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue()))); }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.glClosure.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.glClosure.unknown.data.integrity.issue",
"Unknown data integrity issue with resource GL Closure: " + realCause.getMessage()); "Unknown data integrity issue with resource GL Closure: " + realCause.getMessage());
} }
@@ -154,7 +154,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi
throw new DuplicateFinancialActivityAccountFoundException(financialActivityId); throw new DuplicateFinancialActivityAccountFoundException(financialActivityId);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.glAccount.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.glAccount.unknown.data.integrity.issue",
"Unknown data integrity issue with resource GL Account: " + realCause.getMessage()); "Unknown data integrity issue with resource GL Account: " + realCause.getMessage());
} }
@@ -232,7 +232,7 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount
throw new GLAccountDuplicateException(glCode); throw new GLAccountDuplicateException(glCode);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.glAccount.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.glAccount.unknown.data.integrity.issue",
"Unknown data integrity issue with resource GL Account: " + realCause.getMessage()); "Unknown data integrity issue with resource GL Account: " + realCause.getMessage());
} }
@@ -124,7 +124,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class, officeId); Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class, officeId);
updateRunningBalance(officeId, entityDate); updateRunningBalance(officeId, entityDate);
} catch (EmptyResultDataAccessException e) { } catch (EmptyResultDataAccessException e) {
logger.debug("No results found for updation of office running balance with office id:" + officeId); logger.debug("No results found for updation of office running balance with office id: {}", officeId);
} }
commandProcessingResultBuilder.withOfficeId(officeId); commandProcessingResultBuilder.withOfficeId(officeId);
} }
@@ -639,7 +639,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
private void handleJournalEntryDataIntegrityIssues(final DataIntegrityViolationException dve) { private void handleJournalEntryDataIntegrityIssues(final DataIntegrityViolationException dve) {
final Throwable realCause = dve.getMostSpecificCause(); final Throwable realCause = dve.getMostSpecificCause();
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.glJournalEntry.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.glJournalEntry.unknown.data.integrity.issue",
"Unknown data integrity issue with resource Journal Entry: " + realCause.getMessage()); "Unknown data integrity issue with resource Journal Entry: " + realCause.getMessage());
} }
@@ -89,7 +89,7 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco
throw new AccountingRuleDuplicateException(command.stringValueOfParameterNamed(AccountingRuleJsonInputParams.NAME.getValue())); throw new AccountingRuleDuplicateException(command.stringValueOfParameterNamed(AccountingRuleJsonInputParams.NAME.getValue()));
} else if (realCause.getMessage().contains("UNIQUE_ACCOUNT_RULE_TAGS")) { throw new AccountingRuleDuplicateException(); } } else if (realCause.getMessage().contains("UNIQUE_ACCOUNT_RULE_TAGS")) { throw new AccountingRuleDuplicateException(); }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.accounting.rule.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.accounting.rule.unknown.data.integrity.issue",
"Unknown data integrity issue with resource Accounting Rule: " + realCause.getMessage()); "Unknown data integrity issue with resource Accounting Rule: " + realCause.getMessage());
} }
@@ -105,16 +105,17 @@ public class AdHocScheduledJobRunnerServiceImpl implements AdHocScheduledJobRunn
.append(adhoc.getQuery()); .append(adhoc.getQuery());
if (insertSqlBuilder.length() > 0) { if (insertSqlBuilder.length() > 0) {
final int result = this.jdbcTemplate.update(insertSqlBuilder.toString()); final int result = this.jdbcTemplate.update(insertSqlBuilder.toString());
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by inserted: " + result); logger.info("{}: Results affected by inserted: {}", ThreadLocalContextUtil.getTenant().getName(), result);
this.jdbcTemplate.update("UPDATE m_adhoc SET last_run=? WHERE id=?", new Date(), adhoc.getId()); this.jdbcTemplate.update("UPDATE m_adhoc SET last_run=? WHERE id=?", new Date(), adhoc.getId());
} }
} else { } else {
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Skipping execution of " + adhoc.getName() + ", scheduled for execution on " + next); logger.info("{}: Skipping execution of {}, scheduled for execution on {}",
new Object[] { ThreadLocalContextUtil.getTenant().getName(), adhoc.getName(), next });
} }
}); });
}else{ }else{
logger.info(ThreadLocalContextUtil.getTenant().getName() + "Nothing to update "); logger.info("{} Nothing to update", ThreadLocalContextUtil.getTenant().getName());
} }
@@ -93,7 +93,7 @@ public class AdHocWritePlatformServiceJpaRepositoryImpl implements AdHocWritePla
} }
private void logAsErrorUnexpectedDataIntegrityException(final DataIntegrityViolationException dve) { private void logAsErrorUnexpectedDataIntegrityException(final DataIntegrityViolationException dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
@Transactional @Transactional
@@ -85,12 +85,12 @@ public class CommandHandlerProvider implements ApplicationContextAware {
final String[] commandHandlerBeans = this.applicationContext.getBeanNamesForAnnotation(CommandType.class); final String[] commandHandlerBeans = this.applicationContext.getBeanNamesForAnnotation(CommandType.class);
if (ArrayUtils.isNotEmpty(commandHandlerBeans)) { if (ArrayUtils.isNotEmpty(commandHandlerBeans)) {
for (final String commandHandlerName : commandHandlerBeans) { for (final String commandHandlerName : commandHandlerBeans) {
LOGGER.info("Register command handler '" + commandHandlerName + "' ..."); LOGGER.info("Register command handler '{}' ...", commandHandlerName);
final CommandType commandType = this.applicationContext.findAnnotationOnBean(commandHandlerName, CommandType.class); final CommandType commandType = this.applicationContext.findAnnotationOnBean(commandHandlerName, CommandType.class);
try { try {
this.registeredHandlers.put(commandType.entity() + "|" + commandType.action(), commandHandlerName); this.registeredHandlers.put(commandType.entity() + "|" + commandType.action(), commandHandlerName);
} catch (final Throwable th) { } catch (final Throwable th) {
LOGGER.error("Unable to register command handler '" + commandHandlerName + "'!", th); LOGGER.error("Unable to register command handler '{}'!", commandHandlerName, th);
} }
} }
} }
@@ -214,7 +214,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
this.columnValidator.validateSqlInjection(sqlBuilder.toString(), parameters.limitSql()); this.columnValidator.validateSqlInjection(sqlBuilder.toString(), parameters.limitSql());
} }
logger.info("sql: " + sqlBuilder.toString()); logger.info("sql: {}", sqlBuilder);
final String sqlCountRows = "SELECT FOUND_ROWS()"; final String sqlCountRows = "SELECT FOUND_ROWS()";
return this.paginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sqlBuilder.toString(), extraCriteria.getArguments(), rm); return this.paginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sqlBuilder.toString(), extraCriteria.getArguments(), rm);
@@ -251,7 +251,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
} }
sql += extraCriteria.getSQLTemplate(); sql += extraCriteria.getSQLTemplate();
sql += groupAndOrderBySQL; sql += groupAndOrderBySQL;
logger.info("sql: " + sql); logger.info("sql: {}", sql);
return this.jdbcTemplate.query(sql, rm, extraCriteria.getArguments()); return this.jdbcTemplate.query(sql, rm, extraCriteria.getArguments());
} }
@@ -511,4 +511,4 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
} }
} }
} }
@@ -96,14 +96,14 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker); result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker);
numberOfRetries = maxNumberOfRetries + 1; numberOfRetries = maxNumberOfRetries + 1;
} catch (CannotAcquireLockException | ObjectOptimisticLockingFailureException exception) { } catch (CannotAcquireLockException | ObjectOptimisticLockingFailureException exception) {
logger.info("The following command " + command.json() + " has been retried " + numberOfRetries + " time(s)"); logger.info("The following command {} has been retried {} time(s)", command.json(), numberOfRetries);
/*** /***
* Fail if the transaction has been retired for * Fail if the transaction has been retired for
* maxNumberOfRetries * maxNumberOfRetries
**/ **/
if (numberOfRetries >= maxNumberOfRetries) { if (numberOfRetries >= maxNumberOfRetries) {
logger.warn("The following command " + command.json() + " has been retried for the max allowed attempts of " logger.warn("The following command {} has been retried for the max allowed attempts of {} and will be rolled back",
+ numberOfRetries + " and will be rolled back"); command.json(), numberOfRetries);
throw (exception); throw (exception);
} }
/*** /***
@@ -149,7 +149,7 @@ public class AccountNumberFormatWritePlatformServiceJpaRepositoryImpl implements
"Account Format preferences for Account type `" + entityAccountType.getCode() + "` already exists", "externalId", "Account Format preferences for Account type `" + entityAccountType.getCode() + "` already exists", "externalId",
entityAccountType.getValue(), entityAccountType.getCode()); entityAccountType.getValue(), entityAccountType.getCode());
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.account.number.format.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.account.number.format.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -293,7 +293,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
LocalDateTime tenantDateNow = tenantDateTime(); LocalDateTime tenantDateNow = tenantDateTime();
LocalDateTime nextTriggerDate = emailCampaignData.getNextTriggerDate().toLocalDateTime(); LocalDateTime nextTriggerDate = emailCampaignData.getNextTriggerDate().toLocalDateTime();
logger.info("tenant time " + tenantDateNow.toString() + " trigger time " + nextTriggerDate.toString()); logger.info("tenant time {} trigger time {}", tenantDateNow, nextTriggerDate);
if (nextTriggerDate.isBefore(tenantDateNow)) { if (nextTriggerDate.isBefore(tenantDateNow)) {
insertDirectCampaignIntoEmailOutboundTable(emailCampaignData.getParamValue(), emailCampaignData.getEmailSubject(), insertDirectCampaignIntoEmailOutboundTable(emailCampaignData.getParamValue(), emailCampaignData.getEmailSubject(),
emailCampaignData.getMessage(), emailCampaignData.getCampaignName(), emailCampaignData.getId()); emailCampaignData.getMessage(), emailCampaignData.getCampaignName(), emailCampaignData.getId());
@@ -126,7 +126,7 @@ public class EmailWritePlatformServiceJpaRepositoryImpl implements EmailWritePla
if (realCause.getMessage().contains("email_address")) { throw new PlatformDataIntegrityException("error.msg.email.no.email.address.exists", if (realCause.getMessage().contains("email_address")) { throw new PlatformDataIntegrityException("error.msg.email.no.email.address.exists",
"The group, client or staff provided has no email address.", "id"); } "The group, client or staff provided has no email address.", "id"); }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.email.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.email.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -235,9 +235,9 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
} }
} }
} catch (final IOException e) { } catch (final IOException e) {
logger.error("smsParams does not contain the key: " + e.getMessage()); logger.error("smsParams does not contain the key: ", e);
} catch (final RuntimeException e) { } catch (final RuntimeException e) {
logger.debug("Client Office Id and SMS Campaign Office id doesn't match"); logger.debug("Client Office Id and SMS Campaign Office id doesn't match ", e);
} }
} }
} }
@@ -293,9 +293,9 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap); this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap);
} }
} catch (final IOException e) { } catch (final IOException e) {
logger.error("smsParams does not contain the key: " + e.getMessage()); logger.error("smsParams does not contain the key: ", e);
} catch (final RuntimeException e) { } catch (final RuntimeException e) {
logger.debug("Client Office Id and SMS Campaign Office id doesn't match"); logger.debug("Client Office Id and SMS Campaign Office id doesn't match ", e);
} }
} }
} }
@@ -240,7 +240,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
} }
} }
} catch (final IOException e) { } catch (final IOException e) {
logger.error(e.getMessage()); logger.error("Error occured.", e) ;
} }
} }
@@ -302,9 +302,9 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
} }
} }
} catch (final IOException e) { } catch (final IOException e) {
logger.error(e.getMessage()) ; logger.error("Error occured.", e) ;
} catch (final RuntimeException e) { } catch (final RuntimeException e) {
logger.error(e.getMessage()) ; logger.error("Error occured.", e) ;
} }
} }
@@ -347,9 +347,9 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
} }
} }
} catch (final IOException e) { } catch (final IOException e) {
logger.error(e.getMessage()) ; logger.error("Error occured.", e) ;
} catch (final RuntimeException e) { } catch (final RuntimeException e) {
logger.error(e.getMessage()) ; logger.error("Error occured.", e) ;
} }
} }
@@ -391,9 +391,9 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
} }
} }
} catch (final IOException e) { } catch (final IOException e) {
logger.error(e.getMessage()) ; logger.error("Error occured.", e) ;
} catch (final RuntimeException e) { } catch (final RuntimeException e) {
logger.error(e.getMessage()) ; logger.error("Error occured.", e) ;
} }
} }
@@ -537,7 +537,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
final String response = this.genericDataService.generateJsonFromGenericResultsetData(results); final String response = this.genericDataService.generateJsonFromGenericResultsetData(results);
resultList = new ObjectMapper().readValue(response, new TypeReference<List<HashMap<String, Object>>>() {}); resultList = new ObjectMapper().readValue(response, new TypeReference<List<HashMap<String, Object>>>() {});
} catch (JsonParseException e) { } catch (JsonParseException e) {
logger.info("Conversion of report query results to JSON failed: " + e.getMessage() + " - Location: " + e.getLocation()); logger.info("Conversion of report query results to JSON failed", e);
return resultList; return resultList;
} }
// loop changes array date to string date // loop changes array date to string date
@@ -656,7 +656,8 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
LocalDateTime tenantDateNow = tenantDateTime(); LocalDateTime tenantDateNow = tenantDateTime();
LocalDateTime nextTriggerDate = smsCampaign.getNextTriggerDate(); LocalDateTime nextTriggerDate = smsCampaign.getNextTriggerDate();
logger.info("tenant time " + tenantDateNow.toString() + " trigger time " + nextTriggerDate.toString() + JobName.UPDATE_SMS_OUTBOUND_WITH_CAMPAIGN_MESSAGE.name()); logger.info("tenant time {} trigger time {} {}",
new Object[] { tenantDateNow, nextTriggerDate, JobName.UPDATE_SMS_OUTBOUND_WITH_CAMPAIGN_MESSAGE.name() });
if (nextTriggerDate.isBefore(tenantDateNow)) { if (nextTriggerDate.isBefore(tenantDateNow)) {
insertDirectCampaignIntoSmsOutboundTable(smsCampaign); insertDirectCampaignIntoSmsOutboundTable(smsCampaign);
this.updateTriggerDates(smsCampaign.getId()); this.updateTriggerDates(smsCampaign.getId());
@@ -102,7 +102,7 @@ public class CodeValueWritePlatformServiceJpaRepositoryImpl implements CodeValue
+ "' already exists", "name", name); + "' already exists", "name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.code.value.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.code.value.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -161,7 +161,7 @@ public class CodeValueWritePlatformServiceJpaRepositoryImpl implements CodeValue
.withSubEntityId(codeValueId)// .withSubEntityId(codeValueId)//
.build(); .build();
} catch (final DataIntegrityViolationException dve) { } catch (final DataIntegrityViolationException dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
final Throwable realCause = dve.getMostSpecificCause(); final Throwable realCause = dve.getMostSpecificCause();
if (realCause.getMessage().contains("code_value")) { throw new PlatformDataIntegrityException("error.msg.codeValue.in.use", if (realCause.getMessage().contains("code_value")) { throw new PlatformDataIntegrityException("error.msg.codeValue.in.use",
"This code value is in use", codeValueId); } "This code value is in use", codeValueId); }
@@ -148,7 +148,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
"name", name); "name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.cund.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.cund.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -107,7 +107,7 @@ public class GlobalConfigurationWritePlatformServiceJpaRepositoryImpl implements
private void handleDataIntegrityIssues(final DataIntegrityViolationException dve) { private void handleDataIntegrityIssues(final DataIntegrityViolationException dve) {
final Throwable realCause = dve.getMostSpecificCause(); final Throwable realCause = dve.getMostSpecificCause();
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.globalConfiguration.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.globalConfiguration.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -46,7 +46,7 @@ public class DataSourceConfiguration {
public DataSource tenantDataSourceJndi() { public DataSource tenantDataSourceJndi() {
PoolConfiguration p = getProperties(); PoolConfiguration p = getProperties();
org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(p); org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(p);
logger.info("Created new DataSource; url=" + p.getUrl()); logger.info("Created new DataSource; url={}", p.getUrl());
return ds; return ds;
} }
@@ -72,7 +72,7 @@ public class TenantDataSourcePortFixService {
public void fixUpTenantsSchemaServerPort() { public void fixUpTenantsSchemaServerPort() {
if (!enabled) { if (!enabled) {
logger.info("No schema_server_port UPDATE made to tenant_server_connections table of the fineract_tenants schema, because " + ENABLED + " = false"); logger.info("No schema_server_port UPDATE made to tenant_server_connections table of the fineract_tenants schema, because {} = false", ENABLED);
return; return;
} }
if (dsp == null) { if (dsp == null) {
@@ -86,10 +86,8 @@ public class TenantDataSourcePortFixService {
if ( r == 0 ) if ( r == 0 )
logger.warn("UPDATE tenant_server_connections SET ... did not update ANY rows - something is probably wrong"); logger.warn("UPDATE tenant_server_connections SET ... did not update ANY rows - something is probably wrong");
else else
logger.info("Upated " logger.info("Upated {} rows in the tenant_server_connections table of the fineract_tenants schema to the real current host: {}, port: {}",
+ r new Object[] { r, dsp.getHost(), dsp.getPort() });
+ " rows in the tenant_server_connections table of the fineract_tenants schema to the real current host: "
+ dsp.getHost() + ", port: " + dsp.getPort());
} }
} }
@@ -105,7 +105,7 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData
final String foreignKeyColumnName = EntityTables.getForeignKeyColumnNameOnDatatable(entity); final String foreignKeyColumnName = EntityTables.getForeignKeyColumnNameOnDatatable(entity);
final boolean columnExist = datatableData.hasColumn(foreignKeyColumnName); final boolean columnExist = datatableData.hasColumn(foreignKeyColumnName);
logger.info(datatableData.getRegisteredTableName() + "has column " + foreignKeyColumnName + " ? " + columnExist); logger.info("{} has column {} ? {}", new Object[] { datatableData.getRegisteredTableName(), foreignKeyColumnName, columnExist });
if (!columnExist) { throw new EntityDatatableCheckNotSupportedException(datatableData.getRegisteredTableName(), entity); } if (!columnExist) { throw new EntityDatatableCheckNotSupportedException(datatableData.getRegisteredTableName(), entity); }
@@ -163,7 +163,7 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData
final String datatableName = t.getDatatableName(); final String datatableName = t.getDatatableName();
final Long countEntries = readWriteNonCoreDataService.countDatatableEntries(datatableName, entityId, foreignKeyColumn); final Long countEntries = readWriteNonCoreDataService.countDatatableEntries(datatableName, entityId, foreignKeyColumn);
logger.info("The are " + countEntries + " entries in the table " + datatableName); logger.info("The are {} entries in the table {}", countEntries, datatableName);
if (countEntries.intValue() == 0) { if (countEntries.intValue() == 0) {
reqDatatables.add(datatableName); reqDatatables.add(datatableName);
} }
@@ -189,7 +189,7 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData
final String datatableName = t.getDatatableName(); final String datatableName = t.getDatatableName();
final Long countEntries = readWriteNonCoreDataService.countDatatableEntries(datatableName, entityId, foreignKeyColumn); final Long countEntries = readWriteNonCoreDataService.countDatatableEntries(datatableName, entityId, foreignKeyColumn);
logger.info("The are " + countEntries + " entries in the table " + datatableName); logger.info("The are {} entries in the table {}", countEntries, datatableName);
if (countEntries.intValue() == 0) { if (countEntries.intValue() == 0) {
reqDatatables.add(datatableName); reqDatatables.add(datatableName);
} }
@@ -289,7 +289,7 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData
throw new EntityDatatableCheckAlreadyExistsException(entity, status, datatableName, productId); throw new EntityDatatableCheckAlreadyExistsException(entity, status, datatableName, productId);
} }
logger.error(dae.getMessage(), dae); logger.error("Error occured.", dae);
throw new PlatformDataIntegrityException("error.msg.report.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.report.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -126,7 +126,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
final StringBuffer writer = new StringBuffer(); final StringBuffer writer = new StringBuffer();
final List<ResultsetColumnHeaderData> columnHeaders = result.getColumnHeaders(); final List<ResultsetColumnHeaderData> columnHeaders = result.getColumnHeaders();
logger.info("NO. of Columns: " + columnHeaders.size()); logger.info("NO. of Columns: {}", columnHeaders.size());
final Integer chSize = columnHeaders.size(); final Integer chSize = columnHeaders.size();
for (int i = 0; i < chSize; i++) { for (int i = 0; i < chSize; i++) {
writer.append('"' + columnHeaders.get(i).getColumnName() + '"'); writer.append('"' + columnHeaders.get(i).getColumnName() + '"');
@@ -144,7 +144,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
String currVal; String currVal;
final String doubleQuote = "\""; final String doubleQuote = "\"";
final String twoDoubleQuotes = doubleQuote + doubleQuote; final String twoDoubleQuotes = doubleQuote + doubleQuote;
logger.info("NO. of Rows: " + data.size()); logger.info("NO. of Rows: {}", data.size());
for (int i = 0; i < data.size(); i++) { for (int i = 0; i < data.size(); i++) {
row = data.get(i).getRow(); row = data.get(i).getRow();
rSize = row.size(); rSize = row.size();
@@ -176,14 +176,14 @@ public class ReadReportingServiceImpl implements ReadReportingService {
final Map<String, String> queryParams, final boolean isSelfServiceUserReport) { final Map<String, String> queryParams, final boolean isSelfServiceUserReport) {
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
logger.info("STARTING REPORT: " + name + " Type: " + type); logger.info("STARTING REPORT: {} Type: {}", name, type);
final String sql = getSQLtoRun(name, type, queryParams, isSelfServiceUserReport); final String sql = getSQLtoRun(name, type, queryParams, isSelfServiceUserReport);
final GenericResultsetData result = this.genericDataService.fillGenericResultSet(sql); final GenericResultsetData result = this.genericDataService.fillGenericResultSet(sql);
final long elapsed = System.currentTimeMillis() - startTime; final long elapsed = System.currentTimeMillis() - startTime;
logger.info("FINISHING Report/Request Name: " + name + " - " + type + " Elapsed Time: " + elapsed); logger.info("FINISHING Report/Request Name: {} - {} Elapsed Time: {}", new Object[] { name, type, elapsed });
return result; return result;
} }
@@ -195,7 +195,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
final Set<String> keys = queryParams.keySet(); final Set<String> keys = queryParams.keySet();
for (final String key : keys) { for (final String key : keys) {
final String pValue = queryParams.get(key); final String pValue = queryParams.get(key);
// logger.info("(" + key + " : " + pValue + ")"); // logger.info("({} : {})", key, pValue);
sql = this.genericDataService.replace(sql, key, pValue); sql = this.genericDataService.replace(sql, key, pValue);
} }
@@ -263,7 +263,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
final List<ResultsetRowData> data = result.getData(); final List<ResultsetRowData> data = result.getData();
List<String> row; List<String> row;
logger.info("NO. of Columns: " + columnHeaders.size()); logger.info("NO. of Columns: {}", columnHeaders.size());
final Integer chSize = columnHeaders.size(); final Integer chSize = columnHeaders.size();
final Document document = new Document(PageSize.B0.rotate()); final Document document = new Document(PageSize.B0.rotate());
@@ -284,7 +284,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
Integer rSize; Integer rSize;
String currColType; String currColType;
String currVal; String currVal;
logger.info("NO. of Rows: " + data.size()); logger.info("NO. of Rows: {}", data.size());
for (int i = 0; i < data.size(); i++) { for (int i = 0; i < data.size(); i++) {
row = data.get(i).getRow(); row = data.get(i).getRow();
rSize = row.size(); rSize = row.size();
@@ -307,7 +307,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
document.close(); document.close();
return genaratePdf; return genaratePdf;
} catch (final Exception e) { } catch (final Exception e) {
logger.error("error.msg.reporting.error:" + e.getMessage()); logger.error("error.msg.reporting.error:", e);
throw new PlatformDataIntegrityException("error.msg.exception.error", e.getMessage()); throw new PlatformDataIntegrityException("error.msg.exception.error", e.getMessage());
} }
} }
@@ -506,14 +506,14 @@ public class ReadReportingServiceImpl implements ReadReportingService {
@Override @Override
public GenericResultsetData retrieveGenericResultSetForSmsEmailCampaign(String name, String type, Map<String, String> queryParams) { public GenericResultsetData retrieveGenericResultSetForSmsEmailCampaign(String name, String type, Map<String, String> queryParams) {
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
logger.info("STARTING REPORT: " + name + " Type: " + type); logger.info("STARTING REPORT: {} Type: {}", name, type);
final String sql = sqlToRunForSmsEmailCampaign(name, type, queryParams); final String sql = sqlToRunForSmsEmailCampaign(name, type, queryParams);
final GenericResultsetData result = this.genericDataService.fillGenericResultSet(sql); final GenericResultsetData result = this.genericDataService.fillGenericResultSet(sql);
final long elapsed = System.currentTimeMillis() - startTime; final long elapsed = System.currentTimeMillis() - startTime;
logger.info("FINISHING Report/Request Name: " + name + " - " + type + " Elapsed Time: " + elapsed); logger.info("FINISHING Report/Request Name: {} - {} Elapsed Time: {}", new Object[] { name, type, elapsed });
return result; return result;
} }
@@ -553,7 +553,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
final String reportPath = FileSystemContentRepository.FINERACT_BASE_DIR + File.separator + "pentahoReports" + File.separator final String reportPath = FileSystemContentRepository.FINERACT_BASE_DIR + File.separator + "pentahoReports" + File.separator
+ reportName + ".prpt"; + reportName + ".prpt";
logger.info("Report path: " + reportPath); logger.info("Report path: {}", reportPath);
// load report definition // load report definition
final ResourceManager manager = new ResourceManager(); final ResourceManager manager = new ResourceManager();
@@ -206,7 +206,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
@Transactional @Transactional
@@ -749,7 +749,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
try { try {
codeId = this.jdbcTemplate.queryForObject(checkColumnCodeMapping.toString(), Integer.class); codeId = this.jdbcTemplate.queryForObject(checkColumnCodeMapping.toString(), Integer.class);
} catch (final EmptyResultDataAccessException e) { } catch (final EmptyResultDataAccessException e) {
logger.info(e.getMessage()); logger.info("Error occured.", e);
} }
return ObjectUtils.defaultIfNull(codeId, 0); return ObjectUtils.defaultIfNull(codeId, 0);
} }
@@ -1133,7 +1133,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
pkValue = datatableId; pkValue = datatableId;
} }
final String sql = getUpdateSql(grs.getColumnHeaders(), dataTableName, pkName, pkValue, changes); final String sql = getUpdateSql(grs.getColumnHeaders(), dataTableName, pkName, pkValue, changes);
logger.info("Update sql: " + sql); logger.info("Update sql: {}", sql);
if (StringUtils.isNotBlank(sql)) { if (StringUtils.isNotBlank(sql)) {
this.jdbcTemplate.update(sql); this.jdbcTemplate.update(sql);
changes.put("locale", dataParams.get("locale")); changes.put("locale", dataParams.get("locale"));
@@ -1240,7 +1240,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
private CommandProcessingResult checkMainResourceExistsWithinScope(final String appTable, final Long appTableId) { private CommandProcessingResult checkMainResourceExistsWithinScope(final String appTable, final Long appTableId) {
final String sql = dataScopedSQL(appTable, appTableId); final String sql = dataScopedSQL(appTable, appTableId);
logger.info("data scoped sql: " + sql); logger.info("data scoped sql: {}", sql);
final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql);
if (!rs.next()) { throw new DatatableNotFoundException(appTable, appTableId); } if (!rs.next()) { throw new DatatableNotFoundException(appTable, appTableId); }
@@ -1432,7 +1432,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
addSql = "insert into `" + datatable + "` (`" + fkName + "` " + insertColumns + ")" + " select " + appTableId + " as id" addSql = "insert into `" + datatable + "` (`" + fkName + "` " + insertColumns + ")" + " select " + appTableId + " as id"
+ selectColumns; + selectColumns;
logger.info(addSql); logger.info("{}", addSql);
return addSql; return addSql;
} }
@@ -1483,7 +1483,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
+ " as id" + selectColumns + " , ( SELECT SUM( code_score ) FROM m_code_value WHERE m_code_value.id IN (" + scoresId + " as id" + selectColumns + " , ( SELECT SUM( code_score ) FROM m_code_value WHERE m_code_value.id IN (" + scoresId
+ " ) ) as score"; + " ) ) as score";
logger.info(vaddSql); logger.info("{}", vaddSql);
return vaddSql; return vaddSql;
} }
@@ -185,7 +185,7 @@ public class ReportWritePlatformServiceImpl implements ReportWritePlatformServic
"name", name); "name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.report.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.report.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -93,7 +93,7 @@ public class FileSystemContentRepository implements ContentRepository {
final boolean fileDeleted = deleteFile(location); final boolean fileDeleted = deleteFile(location);
if (!fileDeleted) { if (!fileDeleted) {
// no need to throw an Error, simply log a warning // no need to throw an Error, simply log a warning
logger.warn("Unable to delete image associated with clients with Id " + resourceId); logger.warn("Unable to delete image associated with clients with Id {}", resourceId);
} }
} }
@@ -107,10 +107,10 @@ public class S3ContentRepository implements ContentRepository {
deleteObjectFromS3(location); deleteObjectFromS3(location);
} catch (final AmazonServiceException ase) { } catch (final AmazonServiceException ase) {
deleteObjectAmazonServiceExceptionMessage(ase); deleteObjectAmazonServiceExceptionMessage(ase);
logger.warn("Unable to delete image associated with clients with Id " + resourceId); logger.warn("Unable to delete image associated with clients with Id {}", resourceId);
} catch (final AmazonClientException ace) { } catch (final AmazonClientException ace) {
deleteObjectAmazonClientExceptionMessage(ace); deleteObjectAmazonClientExceptionMessage(ace);
logger.warn("Unable to delete image associated with clients with Id " + resourceId); logger.warn("Unable to delete image associated with clients with Id {}", resourceId);
} }
} }
@@ -128,7 +128,7 @@ public class S3ContentRepository implements ContentRepository {
final S3Object s3object = this.s3Client.getObject(new GetObjectRequest(this.s3BucketName, documentData.fileLocation())); final S3Object s3object = this.s3Client.getObject(new GetObjectRequest(this.s3BucketName, documentData.fileLocation()));
fileData = new FileData(s3object.getObjectContent(), fileName, documentData.contentType()); fileData = new FileData(s3object.getObjectContent(), fileName, documentData.contentType());
} catch (final AmazonClientException ace) { } catch (final AmazonClientException ace) {
logger.error(ace.getMessage()); logger.error("Error occured.", ace);
throw new DocumentNotFoundException(documentData.getParentEntityType(), documentData.getParentEntityId(), documentData.getId()); throw new DocumentNotFoundException(documentData.getParentEntityType(), documentData.getParentEntityId(), documentData.getId());
} }
return fileData; return fileData;
@@ -140,21 +140,21 @@ public class S3ContentRepository implements ContentRepository {
final S3Object s3object = this.s3Client.getObject(new GetObjectRequest(this.s3BucketName, imageData.location())); final S3Object s3object = this.s3Client.getObject(new GetObjectRequest(this.s3BucketName, imageData.location()));
imageData.updateContent(s3object.getObjectContent()); imageData.updateContent(s3object.getObjectContent());
}catch(AmazonS3Exception e) { }catch(AmazonS3Exception e) {
logger.error(e.getMessage()); logger.error("Error occured.", e);
} }
return imageData; return imageData;
} }
private void deleteObjectAmazonClientExceptionMessage(final AmazonClientException ace) { private void deleteObjectAmazonClientExceptionMessage(final AmazonClientException ace) {
final String message = "Caught an AmazonClientException." + "Error Message: " + ace.getMessage(); final String message = "Caught an AmazonClientException." + "Error Message: " + ace.getMessage();
logger.error(message); logger.error("{}", message);
} }
private void deleteObjectAmazonServiceExceptionMessage(final AmazonServiceException ase) { private void deleteObjectAmazonServiceExceptionMessage(final AmazonServiceException ase) {
final String message = "Caught an AmazonServiceException." + "Error Message: " + ase.getMessage() + "HTTP Status Code: " final String message = "Caught an AmazonServiceException." + "Error Message: " + ase.getMessage() + "HTTP Status Code: "
+ ase.getStatusCode() + "AWS Error Code: " + ase.getErrorCode() + "Error Type: " + ase.getErrorType() + ase.getStatusCode() + "AWS Error Code: " + ase.getErrorCode() + "Error Type: " + ase.getErrorType()
+ "Request ID: " + ase.getRequestId(); + "Request ID: " + ase.getRequestId();
logger.error(message); logger.error("{}", message);
} }
private String generateFileParentDirectory(final String entityType, final Long entityId) { private String generateFileParentDirectory(final String entityType, final Long entityId) {
@@ -173,7 +173,7 @@ public class S3ContentRepository implements ContentRepository {
private void uploadDocument(final String filename, final InputStream inputStream, final String s3UploadLocation) private void uploadDocument(final String filename, final InputStream inputStream, final String s3UploadLocation)
throws ContentManagementException { throws ContentManagementException {
try { try {
logger.info("Uploading a new object to S3 from a file to " + s3UploadLocation); logger.info("Uploading a new object to S3 from a file to {}", s3UploadLocation);
this.s3Client.putObject(new PutObjectRequest(this.s3BucketName, s3UploadLocation, inputStream, new ObjectMetadata())); this.s3Client.putObject(new PutObjectRequest(this.s3BucketName, s3UploadLocation, inputStream, new ObjectMetadata()));
} catch (final AmazonClientException ace) { } catch (final AmazonClientException ace) {
final String message = ace.getMessage(); final String message = ace.getMessage();
@@ -61,7 +61,7 @@ public class FileData {
if (this.inputStream == null) { return new FileInputStream(this.file); } if (this.inputStream == null) { return new FileInputStream(this.file); }
return this.inputStream; return this.inputStream;
} catch (final FileNotFoundException e) { } catch (final FileNotFoundException e) {
logger.error(e.toString()); logger.error("Error occured.", e);
return null; return null;
} }
} }
@@ -67,7 +67,7 @@ public class ImageData {
return IOUtils.toByteArray(fileInputStream); return IOUtils.toByteArray(fileInputStream);
} }
} catch (IOException e) { } catch (IOException e) {
logger.error(e.getMessage()); logger.error("Error occured.", e);
} }
return null; return null;
} }
@@ -112,7 +112,7 @@ public class ImageData {
out = resizeImage(this.inputStream, maxWidth != null ? maxWidth : Integer.MAX_VALUE, out = resizeImage(this.inputStream, maxWidth != null ? maxWidth : Integer.MAX_VALUE,
maxHeight != null ? maxHeight : Integer.MAX_VALUE); maxHeight != null ? maxHeight : Integer.MAX_VALUE);
} catch (IOException e) { } catch (IOException e) {
logger.error(e.getMessage()); logger.error("Error occured.", e);
} }
} else if (this.storageType.equals(StorageType.FILE_SYSTEM.getValue()) && this.file != null) { } else if (this.storageType.equals(StorageType.FILE_SYSTEM.getValue()) && this.file != null) {
FileInputStream fis = null; FileInputStream fis = null;
@@ -120,13 +120,13 @@ public class ImageData {
fis = new FileInputStream(this.file); fis = new FileInputStream(this.file);
out = resizeImage(fis, maxWidth != null ? maxWidth : Integer.MAX_VALUE, maxHeight != null ? maxHeight : Integer.MAX_VALUE); out = resizeImage(fis, maxWidth != null ? maxWidth : Integer.MAX_VALUE, maxHeight != null ? maxHeight : Integer.MAX_VALUE);
} catch (IOException ex) { } catch (IOException ex) {
logger.error(ex.getMessage()); logger.error("Error occured.", ex);
} finally { } finally {
if (fis != null) { if (fis != null) {
try { try {
fis.close(); fis.close();
} catch (IOException ex) { } catch (IOException ex) {
logger.error(ex.getMessage()); logger.error("Error occured.", ex);
} }
} }
} }
@@ -181,7 +181,7 @@ public class ImageData {
try { try {
available = this.inputStream.available(); available = this.inputStream.available();
} catch (IOException e) { } catch (IOException e) {
logger.error(e.getMessage()); logger.error("Error occured.", e);
} }
} else if (this.storageType.equals(StorageType.FILE_SYSTEM.getValue()) && this.file != null) { } else if (this.storageType.equals(StorageType.FILE_SYSTEM.getValue()) && this.file != null) {
FileInputStream fileInputStream = null; FileInputStream fileInputStream = null;
@@ -190,9 +190,9 @@ public class ImageData {
available = fileInputStream.available(); available = fileInputStream.available();
fileInputStream.close(); fileInputStream.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
logger.error(e.getMessage()); logger.error("Error occured.", e);
} catch (IOException e) { } catch (IOException e) {
logger.error(e.getMessage()); logger.error("Error occured.", e);
} finally { } finally {
if (fileInputStream != null) { if (fileInputStream != null) {
try { try {
@@ -80,7 +80,7 @@ public class DocumentWritePlatformServiceJpaRepositoryImpl implements DocumentWr
return document.getId(); return document.getId();
} catch (final DataIntegrityViolationException dve) { } catch (final DataIntegrityViolationException dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.document.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.document.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -136,11 +136,11 @@ public class DocumentWritePlatformServiceJpaRepositoryImpl implements DocumentWr
return new CommandProcessingResult(documentForUpdate.getId()); return new CommandProcessingResult(documentForUpdate.getId());
} catch (final DataIntegrityViolationException dve) { } catch (final DataIntegrityViolationException dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.document.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.document.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} catch (final ContentManagementException cme) { } catch (final ContentManagementException cme) {
logger.error(cme.getMessage(), cme); logger.error("Error occured.", cme);
throw new ContentManagementException(documentCommand.getName(), cme.getMessage()); throw new ContentManagementException(documentCommand.getName(), cme.getMessage());
} }
} }
@@ -23,7 +23,6 @@ import java.sql.SQLException;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import org.apache.fineract.infrastructure.core.service.RoutingDataSource; import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
import org.apache.fineract.infrastructure.dataqueries.service.GenericDataServiceImpl;
import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityAccessData; import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityAccessData;
import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityRelationData; import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityRelationData;
import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityToEntityMappingData; import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityToEntityMappingData;
@@ -47,7 +46,7 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final JdbcTemplate jdbcTemplate; private final JdbcTemplate jdbcTemplate;
private final static Logger logger = LoggerFactory.getLogger(GenericDataServiceImpl.class); private final static Logger logger = LoggerFactory.getLogger(FineractEntityAccessReadServiceImpl.class);
private final FineractEntityRelationRepositoryWrapper fineractEntityRelationRepository; private final FineractEntityRelationRepositoryWrapper fineractEntityRelationRepository;
@Autowired @Autowired
@@ -107,7 +106,7 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
if (accessListCSVStrBuf != null) { if (accessListCSVStrBuf != null) {
returnIdListStr = accessListCSVStrBuf.toString(); returnIdListStr = accessListCSVStrBuf.toString();
} }
logger.debug("List of IDs applicable:" + returnIdListStr); logger.debug("List of IDs applicable: {}", returnIdListStr);
return returnIdListStr; return returnIdListStr;
} }
@@ -144,7 +143,7 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
str.append("from m_entity_to_entity_mapping eem "); str.append("from m_entity_to_entity_mapping eem ");
str.append("where eem.rel_id = ? "); str.append("where eem.rel_id = ? ");
str.append("and eem.from_id = ? "); str.append("and eem.from_id = ? ");
logger.debug(str.toString()); logger.debug("{}", str);
return str.toString(); return str.toString();
} }
@@ -178,7 +178,7 @@ public class FineractEntityAccessWriteServiceImpl implements FineractEntityAcces
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
/* /*
@@ -95,13 +95,12 @@ public class ProcessorHelper {
return new Callback() { return new Callback() {
@Override @Override
public void success(final Object o, final Response response) { public void success(final Object o, final Response response) {
logger.info("URL : " + url + "\tStatus : " logger.info("URL: {}\tStatus: {}", url, response.getStatus());
+ response.getStatus());
} }
@Override @Override
public void failure(final RetrofitError retrofitError) { public void failure(final RetrofitError retrofitError) {
logger.info(retrofitError.getMessage()); logger.info("Error occured.", retrofitError);
} }
}; };
} }
@@ -164,7 +164,7 @@ public class JobRegisterServiceImpl implements JobRegisterService, ApplicationLi
} catch (final Exception e) { } catch (final Exception e) {
final String msg = "Job execution failed for job with id:" + scheduledJobDetail.getId(); final String msg = "Job execution failed for job with id:" + scheduledJobDetail.getId();
logger.error(msg, e); logger.error("{}", msg, e);
throw new PlatformInternalServerException("error.msg.sheduler.job.execution.failed", msg, scheduledJobDetail.getId()); throw new PlatformInternalServerException("error.msg.sheduler.job.execution.failed", msg, scheduledJobDetail.getId());
} }
@@ -223,7 +223,7 @@ public class JobRegisterServiceImpl implements JobRegisterService, ApplicationLi
} }
} }
} catch (final SchedulerException e) { } catch (final SchedulerException e) {
logger.error(e.getMessage(), e); logger.error("Error occured.", e);
} }
} }
jobDetail.updateTriggerMisfired(false); jobDetail.updateTriggerMisfired(false);
@@ -281,7 +281,7 @@ public class JobRegisterServiceImpl implements JobRegisterService, ApplicationLi
scheduledJobDetails.updateNextRunTime(null); scheduledJobDetails.updateNextRunTime(null);
final String stackTrace = getStackTraceAsString(throwable); final String stackTrace = getStackTraceAsString(throwable);
scheduledJobDetails.updateErrorLog(stackTrace); scheduledJobDetails.updateErrorLog(stackTrace);
logger.error("Could not schedule job: " + scheduledJobDetails.getJobName(), throwable); logger.error("Could not schedule job: {}", scheduledJobDetails.getJobName(), throwable);
} }
scheduledJobDetails.updateCurrentlyRunningStatus(false); scheduledJobDetails.updateCurrentlyRunningStatus(false);
} }
@@ -292,7 +292,7 @@ public class JobRegisterServiceImpl implements JobRegisterService, ApplicationLi
try { try {
scheduler.shutdown(); scheduler.shutdown();
} catch (final SchedulerException e) { } catch (final SchedulerException e) {
logger.error(e.getMessage(), e); logger.error("Error occured.", e);
} }
} }
} }
@@ -317,7 +317,7 @@ public class JobRegisterServiceImpl implements JobRegisterService, ApplicationLi
try { try {
scheduler.shutdown(); scheduler.shutdown();
} catch (final SchedulerException e) { } catch (final SchedulerException e) {
logger.error(e.getMessage(), e); logger.error("Error occured.", e);
} }
} }
@@ -82,7 +82,7 @@ public class SchedulerTriggerListener implements TriggerListener {
proceedJob = this.schedularService.processJobDetailForExecution(jobKey, triggerType); proceedJob = this.schedularService.processJobDetailForExecution(jobKey, triggerType);
numberOfRetries = maxNumberOfRetries + 1; numberOfRetries = maxNumberOfRetries + 1;
} catch (Exception exception) { //Adding generic exception as it depends on JPA provider } catch (Exception exception) { //Adding generic exception as it depends on JPA provider
logger.debug("Not able to acquire the lock to update job running status for JobKey: " + jobKey); logger.debug("Not able to acquire the lock to update job running status for JobKey: {}", jobKey);
try { try {
Random random = new Random(); Random random = new Random();
int randomNum = random.nextInt(maxIntervalBetweenRetries + 1); int randomNum = random.nextInt(maxIntervalBetweenRetries + 1);
@@ -70,12 +70,12 @@ public class ReportingProcessServiceProvider implements ApplicationContextAware
final String[] reportServiceBeans = this.applicationContext.getBeanNamesForAnnotation(ReportService.class); final String[] reportServiceBeans = this.applicationContext.getBeanNamesForAnnotation(ReportService.class);
if (ArrayUtils.isNotEmpty(reportServiceBeans)) { if (ArrayUtils.isNotEmpty(reportServiceBeans)) {
for (final String reportName : reportServiceBeans) { for (final String reportName : reportServiceBeans) {
LOGGER.info("Register report service '" + reportName + "' ..."); LOGGER.info("Register report service '{}' ...", reportName);
final ReportService service = this.applicationContext.findAnnotationOnBean(reportName, ReportService.class); final ReportService service = this.applicationContext.findAnnotationOnBean(reportName, ReportService.class);
try { try {
this.reportingProcessServices.put(service.type(), reportName); this.reportingProcessServices.put(service.type(), reportName);
} catch (final Throwable th) { } catch (final Throwable th) {
LOGGER.error("Unable to register reporting service '" + reportName + "'!", th); LOGGER.error("Unable to register reporting service '{}'!", reportName, th);
} }
} }
} }
@@ -399,7 +399,7 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
ReportMailingJobConstants.NAME_PARAM_NAME, name); ReportMailingJobConstants.NAME_PARAM_NAME, name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.charge.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.charge.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
@@ -152,7 +152,7 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
} finally { } finally {
task.stop(); task.stop();
final PlatformRequestLog log = PlatformRequestLog.from(task, request); final PlatformRequestLog log = PlatformRequestLog.from(task, request);
logger.debug(this.toApiJsonSerializer.serialize(log)); logger.debug("{}", this.toApiJsonSerializer.serialize(log));
} }
} }
@@ -152,7 +152,7 @@ public class TenantAwareTenantIdentifierFilter extends GenericFilterBean {
} finally { } finally {
task.stop(); task.stop();
final PlatformRequestLog log = PlatformRequestLog.from(task, request); final PlatformRequestLog log = PlatformRequestLog.from(task, request);
logger.info(this.toApiJsonSerializer.serialize(log)); logger.info("{}", this.toApiJsonSerializer.serialize(log));
} }
} }
@@ -63,11 +63,11 @@ public class CustomAuthenticationFailureHandler implements AuthenticationFailure
saveException(request, exception); saveException(request, exception);
if (this.forwardToDestination) { if (this.forwardToDestination) {
this.logger.debug("Forwarding to " + this.defaultFailureUrl); this.logger.debug("Forwarding to {}", this.defaultFailureUrl);
request.getRequestDispatcher(this.defaultFailureUrl).forward(request, response); request.getRequestDispatcher(this.defaultFailureUrl).forward(request, response);
} else { } else {
this.logger.debug("Redirecting to " + this.defaultFailureUrl); this.logger.debug("Redirecting to {}", this.defaultFailureUrl);
final String oauthToken = request.getParameter("oauth_token"); final String oauthToken = request.getParameter("oauth_token");
request.setAttribute("oauth_token", oauthToken); request.setAttribute("oauth_token", oauthToken);
@@ -181,7 +181,7 @@ public class SmsMessageScheduledJobServiceImpl implements SmsMessageScheduledJob
if (responseOne != null) { if (responseOne != null) {
// String smsResponse = responseOne.getBody(); // String smsResponse = responseOne.getBody();
if (!responseOne.getStatusCode().equals(HttpStatus.ACCEPTED)) { if (!responseOne.getStatusCode().equals(HttpStatus.ACCEPTED)) {
logger.debug(responseOne.getStatusCode().name()); logger.debug("{}", responseOne.getStatusCode().name());
throw new ConnectionFailureException(SmsCampaignConstants.SMS); throw new ConnectionFailureException(SmsCampaignConstants.SMS);
} }
} }
@@ -223,7 +223,7 @@ public class SmsMessageScheduledJobServiceImpl implements SmsMessageScheduledJob
} }
} }
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error("Error occured.", e);
} }
} }
@@ -242,11 +242,11 @@ public class SmsMessageScheduledJobServiceImpl implements SmsMessageScheduledJob
} }
this.smsMessageRepository.saveAll(smsMessages); this.smsMessageRepository.saveAll(smsMessages);
request.append(SmsMessageApiQueueResourceData.toJsonString(apiQueueResourceDatas)); request.append(SmsMessageApiQueueResourceData.toJsonString(apiQueueResourceDatas));
logger.info("Sending triggered SMS to specific provider with request - " + request.toString()); logger.info("Sending triggered SMS to specific provider with request - {}", request);
this.triggeredExecutorService.execute(new SmsTask(ThreadLocalContextUtil.getTenant(), this.triggeredExecutorService.execute(new SmsTask(ThreadLocalContextUtil.getTenant(),
apiQueueResourceDatas)); apiQueueResourceDatas));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error("Error occured.", e);
} }
} }
@@ -320,20 +320,19 @@ public class SmsMessageScheduledJobServiceImpl implements SmsMessageScheduledJob
this.smsMessageRepository.save(smsMessage); this.smsMessageRepository.save(smsMessage);
if (statusChanged) { if (statusChanged) {
logger.info("Status of SMS message id: " + smsMessage.getId() + " successfully changed to " + statusType); logger.info("Status of SMS message id: {} successfully changed to {}", smsMessage.getId(), statusType);
} }
} }
} }
if (smsMessageDeliveryReportDatas.size() > 0) { if (smsMessageDeliveryReportDatas.size() > 0) {
logger.info(smsMessageDeliveryReportDatas.size() + " " logger.info("{} delivery report(s) successfully received from the intermediate gateway - sms", smsMessageDeliveryReportDatas.size());
+ "delivery report(s) successfully received from the intermediate gateway - sms");
} }
} }
} }
catch (Exception e) { catch (Exception e) {
logger.error(e.getMessage(), e); logger.error("Error occured.", e);
} }
page ++; page ++;
totalRecords = smsMessageInternalIds.getTotalFilteredRecords(); totalRecords = smsMessageInternalIds.getTotalFilteredRecords();
@@ -126,7 +126,7 @@ public class SmsWritePlatformServiceJpaRepositoryImpl implements SmsWritePlatfor
if (realCause.getMessage().contains("mobile_no")) { throw new PlatformDataIntegrityException("error.msg.sms.no.mobile.no.exists", if (realCause.getMessage().contains("mobile_no")) { throw new PlatformDataIntegrityException("error.msg.sms.no.mobile.no.exists",
"The group, client or staff provided has no mobile no.", "id"); } "The group, client or staff provided has no mobile no.", "id"); }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.sms.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.sms.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -39,7 +39,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class WriteLikelihoodServiceImpl implements WriteLikelihoodService { public class WriteLikelihoodServiceImpl implements WriteLikelihoodService {
private final static Logger logger = LoggerFactory.getLogger(PovertyLineService.class); private final static Logger logger = LoggerFactory.getLogger(WriteLikelihoodServiceImpl.class);
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final LikelihoodDataValidator likelihoodDataValidator; private final LikelihoodDataValidator likelihoodDataValidator;
private final LikelihoodRepository repository; private final LikelihoodRepository repository;
@@ -95,7 +95,7 @@ public class WriteLikelihoodServiceImpl implements WriteLikelihoodService {
private void handleDataIntegrityIssues(final DataIntegrityViolationException dve) { private void handleDataIntegrityIssues(final DataIntegrityViolationException dve) {
final Throwable realCause = dve.getMostSpecificCause(); final Throwable realCause = dve.getMostSpecificCause();
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.likelihood.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.likelihood.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -21,7 +21,6 @@ package org.apache.fineract.notification.config;
import javax.jms.ExceptionListener; import javax.jms.ExceptionListener;
import javax.jms.JMSException; import javax.jms.JMSException;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.fineract.infrastructure.core.boot.db.TenantDataSourcePortFixService;
import org.apache.fineract.notification.eventandlistener.NotificationEventListener; import org.apache.fineract.notification.eventandlistener.NotificationEventListener;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -43,7 +42,7 @@ public class MessagingConfiguration {
private NotificationEventListener notificationEventListener; private NotificationEventListener notificationEventListener;
@Bean @Bean
public Logger loggerBean() { return LoggerFactory.getLogger(TenantDataSourcePortFixService.class); } public Logger loggerBean() { return LoggerFactory.getLogger(MessagingConfiguration.class); }
private static final String DEFAULT_BROKER_URL = "tcp://localhost:61616"; private static final String DEFAULT_BROKER_URL = "tcp://localhost:61616";
@@ -183,7 +183,7 @@ public class HolidayWritePlatformServiceJpaRepositoryImpl implements HolidayWrit
"name", name); "name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.office.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.office.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -239,7 +239,7 @@ public class OfficeWritePlatformServiceJpaRepositoryImpl implements OfficeWriteP
"name", name); "name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.office.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.office.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -31,7 +31,6 @@ import org.apache.fineract.organisation.provisioning.domain.ProvisioningCategory
import org.apache.fineract.organisation.provisioning.exception.ProvisioningCategoryCannotBeDeletedException; import org.apache.fineract.organisation.provisioning.exception.ProvisioningCategoryCannotBeDeletedException;
import org.apache.fineract.organisation.provisioning.exception.ProvisioningCategoryNotFoundException; import org.apache.fineract.organisation.provisioning.exception.ProvisioningCategoryNotFoundException;
import org.apache.fineract.organisation.provisioning.serialization.ProvisioningCategoryDefinitionJsonDeserializer; import org.apache.fineract.organisation.provisioning.serialization.ProvisioningCategoryDefinitionJsonDeserializer;
import org.apache.fineract.portfolio.charge.service.ChargeWritePlatformServiceJpaRepositoryImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -42,7 +41,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl implements ProvisioningCategoryWritePlatformService { public class ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl implements ProvisioningCategoryWritePlatformService {
private final static Logger logger = LoggerFactory.getLogger(ChargeWritePlatformServiceJpaRepositoryImpl.class); private final static Logger logger = LoggerFactory.getLogger(ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl.class);
private final ProvisioningCategoryRepository provisioningCategoryRepository; private final ProvisioningCategoryRepository provisioningCategoryRepository;
@@ -126,7 +125,7 @@ public class ProvisioningCategoryWritePlatformServiceJpaRepositoryImpl implement
throw new PlatformDataIntegrityException("error.msg.provisioning.duplicate.categoryname", "Provisioning Cateory with name `" throw new PlatformDataIntegrityException("error.msg.provisioning.duplicate.categoryname", "Provisioning Cateory with name `"
+ name + "` already exists", "category name", name); + name + "` already exists", "category name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.charge.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.charge.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -169,7 +169,7 @@ public class ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl implement
"error.msg.provisioning.product.id(s).already.associated.existing.criteria", "error.msg.provisioning.product.id(s).already.associated.existing.criteria",
"The selected products already associated with another Provisioning Criteria"); "The selected products already associated with another Provisioning Criteria");
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.provisioning.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.provisioning.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -139,7 +139,7 @@ public class StaffWritePlatformServiceJpaRepositoryImpl implements StaffWritePla
+ displayName + "' already exists", "displayName", displayName); + displayName + "' already exists", "displayName", displayName);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.staff.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.staff.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -211,7 +211,7 @@ public class TellerWritePlatformServiceJpaImpl implements TellerWritePlatformSer
"name", name); "name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.teller.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.teller.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -144,7 +144,7 @@ public class StandingInstructionWritePlatformServiceImpl implements StandingInst
throw new PlatformDataIntegrityException("error.msg.standinginstruction.duplicate.name", "Standinginstruction with name `" throw new PlatformDataIntegrityException("error.msg.standinginstruction.duplicate.name", "Standinginstruction with name `"
+ name + "` already exists", "name", name); + name + "` already exists", "name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.client.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.client.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -233,7 +233,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
"name", name); "name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.charge.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.charge.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -438,7 +438,7 @@ public class ClientChargeWritePlatformServiceJpaRepositoryImpl implements Client
"Client charge with id `" + clientChargeId + "` cannot be deleted as transactions have been made on the same", "Client charge with id `" + clientChargeId + "` cannot be deleted as transactions have been made on the same",
"clientChargeId", clientChargeId); } "clientChargeId", clientChargeId); }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.client.charges.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.client.charges.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -200,6 +200,6 @@ public class ClientIdentifierWritePlatformServiceJpaRepositoryImpl implements Cl
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
} }
@@ -182,7 +182,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
.build(); .build();
} catch (DataIntegrityViolationException dve) { } catch (DataIntegrityViolationException dve) {
Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ; Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()) ;
logger.error(throwable.getMessage()); logger.error("Error occured.", throwable);
throw new PlatformDataIntegrityException("error.msg.client.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.client.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -615,7 +615,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
@Transactional @Transactional
@@ -177,7 +177,7 @@ public class CollateralWritePlatformServiceJpaRepositoryImpl implements Collater
} }
private void logAsErrorUnexpectedDataIntegrityException(final DataIntegrityViolationException dve) { private void logAsErrorUnexpectedDataIntegrityException(final DataIntegrityViolationException dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
} }
@@ -138,7 +138,7 @@ public class FloatingRateWritePlatformServiceImpl implements
private void logAsErrorUnexpectedDataIntegrityException( private void logAsErrorUnexpectedDataIntegrityException(
Exception dve) { Exception dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
@@ -124,7 +124,7 @@ public class FundWritePlatformServiceJpaRepositoryImpl implements FundWritePlatf
"name", name); "name", name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.fund.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.fund.unknown.data.integrity.issue",
"Unknown data integrity issue with resource: " + realCause.getMessage()); "Unknown data integrity issue with resource: " + realCause.getMessage());
} }
@@ -106,7 +106,7 @@ public class GroupRolesWritePlatformServiceJpaRepositoryImpl implements GroupRol
GroupingTypesApiConstants.clientIdParamName, roleId, clientId, command.getGroupId()); GroupingTypesApiConstants.clientIdParamName, roleId, clientId, command.getGroupId());
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.group.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.group.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -603,7 +603,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
.build(); .build();
} catch (DataIntegrityViolationException dve) { } catch (DataIntegrityViolationException dve) {
Throwable throwable = ExceptionUtils.getRootCause(dve.getCause()); Throwable throwable = ExceptionUtils.getRootCause(dve.getCause());
logger.error(throwable.getMessage()); logger.error("Error occured.", throwable);
throw new PlatformDataIntegrityException("error.msg.group.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.group.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -798,7 +798,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
name); name);
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.group.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.group.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -334,7 +334,7 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto
private void handleGuarantorDataIntegrityIssues(final DataIntegrityViolationException dve) { private void handleGuarantorDataIntegrityIssues(final DataIntegrityViolationException dve) {
final Throwable realCause = dve.getMostSpecificCause(); final Throwable realCause = dve.getMostSpecificCause();
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.guarantor.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.guarantor.unknown.data.integrity.issue",
"Unknown data integrity issue with resource Guarantor: " + realCause.getMessage()); "Unknown data integrity issue with resource Guarantor: " + realCause.getMessage());
} }
@@ -586,7 +586,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
**/ **/
private void handleDataIntegrityViolation(final DataIntegrityViolationException dve) { private void handleDataIntegrityViolation(final DataIntegrityViolationException dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.loan.reschedule.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.loan.reschedule.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
@@ -1079,7 +1079,7 @@ public void checkForProductMixRestrictions(final Loan loan) {
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
@Transactional @Transactional
@@ -41,7 +41,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleIns
import org.apache.fineract.portfolio.loanaccount.domain.LoanSummary; import org.apache.fineract.portfolio.loanaccount.domain.LoanSummary;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanSchedulePeriodData; import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanSchedulePeriodData;
import org.apache.fineract.scheduledjobs.service.ScheduledJobRunnerServiceImpl;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
@@ -57,7 +56,7 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, BusinessEventListner { public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, BusinessEventListner {
private final static Logger logger = LoggerFactory.getLogger(ScheduledJobRunnerServiceImpl.class); private final static Logger logger = LoggerFactory.getLogger(LoanArrearsAgingServiceImpl.class);
private final BusinessEventNotifierService businessEventNotifierService; private final BusinessEventNotifierService businessEventNotifierService;
private final DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); private final DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
private final JdbcTemplate jdbcTemplate; private final JdbcTemplate jdbcTemplate;
@@ -126,7 +125,7 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService, Bus
result += i; result += i;
} }
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by update: " + result); logger.info("{}: Results affected by update: {}", ThreadLocalContextUtil.getTenant().getName(), result);
} }
@Override @Override
@@ -206,7 +206,7 @@ public class LoanSchedularServiceImpl implements LoanSchedularService {
// gets the loanIds data set iteratively and call addAccuruals for that paginated dataset // gets the loanIds data set iteratively and call addAccuruals for that paginated dataset
do { do {
int totalFilteredRecords = loanIds.size(); int totalFilteredRecords = loanIds.size();
logger.info("Starting accrual - total filtered records - " + totalFilteredRecords); logger.info("Starting accrual - total filtered records - {}", totalFilteredRecords);
recalculateInterest(loanIds, threadPoolSize, batchSize, executorService); recalculateInterest(loanIds, threadPoolSize, batchSize, executorService);
maxLoanIdInList+= pageSize+1; maxLoanIdInList+= pageSize+1;
loanIds = Collections.synchronizedList(this.loanReadPlatformService loanIds = Collections.synchronizedList(this.loanReadPlatformService
@@ -58,7 +58,7 @@ public class RecalculateInterestPoster implements Callable<Void> {
if (!loanIds.isEmpty()) { if (!loanIds.isEmpty()) {
int errors = 0; int errors = 0;
for (Long loanId : loanIds) { for (Long loanId : loanIds) {
logger.info("Loan ID " + loanId); logger.info("Loan ID {}", loanId);
Integer numberOfRetries = 0; Integer numberOfRetries = 0;
while (numberOfRetries <= maxNumberOfRetries) { while (numberOfRetries <= maxNumberOfRetries) {
try { try {
@@ -66,7 +66,7 @@ public class RecalculateInterestPoster implements Callable<Void> {
numberOfRetries = maxNumberOfRetries + 1; numberOfRetries = maxNumberOfRetries + 1;
} catch (CannotAcquireLockException } catch (CannotAcquireLockException
| ObjectOptimisticLockingFailureException exception) { | ObjectOptimisticLockingFailureException exception) {
logger.info("Recalulate interest job has been retried time(s)", numberOfRetries); logger.info("Recalulate interest job has been retried {} time(s)", numberOfRetries);
// Fail if the transaction has been retired for maxNumberOfRetries // Fail if the transaction has been retired for maxNumberOfRetries
if (numberOfRetries >= maxNumberOfRetries) { if (numberOfRetries >= maxNumberOfRetries) {
logger.error("Recalulate interest job has been retried for the max allowed attempts of {} and will be rolled back", numberOfRetries); logger.error("Recalulate interest job has been retried for the max allowed attempts of {} and will be rolled back", numberOfRetries);
@@ -91,7 +91,7 @@ public class RecalculateInterestPoster implements Callable<Void> {
} }
i++; i++;
} }
logger.info("Loans count " + i); logger.info("Loans count {}", i);
} }
if (errors > 0) { throw new JobExecutionException(errors); } if (errors > 0) { throw new JobExecutionException(errors); }
} }
@@ -194,7 +194,7 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM
} }
private void logAsErrorUnexpectedDataIntegrityException(final DataIntegrityViolationException dve) { private void logAsErrorUnexpectedDataIntegrityException(final DataIntegrityViolationException dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
private List<ProductMix> updateRestrictedIds(final Set<String> restrictedIds, final List<ProductMix> existedProductMixes) { private List<ProductMix> updateRestrictedIds(final Set<String> restrictedIds, final List<ProductMix> existedProductMixes) {
@@ -341,7 +341,7 @@ public class LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
private Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> constructEntityMap(final BusinessEventNotificationConstants.BUSINESS_ENTITY entityEvent, Object entity) { private Map<BusinessEventNotificationConstants.BUSINESS_ENTITY, Object> constructEntityMap(final BusinessEventNotificationConstants.BUSINESS_ENTITY entityEvent, Object entity) {
@@ -187,7 +187,7 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
} }
errorCodeBuilder.append(".unknown.data.integrity.issue"); errorCodeBuilder.append(".unknown.data.integrity.issue");
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException(errorCodeBuilder.toString(), "Unknown data integrity issue with savings account."); throw new PlatformDataIntegrityException(errorCodeBuilder.toString(), "Unknown data integrity issue with savings account.");
} }
@@ -207,6 +207,6 @@ public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) {
this.logger.error(dae.getMessage(), dae); this.logger.error("Error occured.", dae);
} }
} }
@@ -207,6 +207,6 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) {
this.logger.error(dae.getMessage(), dae); this.logger.error("Error occured.", dae);
} }
} }
@@ -166,7 +166,7 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl
} }
errorCodeBuilder.append(".unknown.data.integrity.issue"); errorCodeBuilder.append(".unknown.data.integrity.issue");
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException(errorCodeBuilder.toString(), "Unknown data integrity issue with savings account."); throw new PlatformDataIntegrityException(errorCodeBuilder.toString(), "Unknown data integrity issue with savings account.");
} }
@@ -105,7 +105,7 @@ public class SavingsProductWritePlatformServiceJpaRepositoryImpl implements Savi
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) {
this.logger.error(dae.getMessage(), dae); this.logger.error("Error occured.", dae);
} }
@Transactional @Transactional
@@ -200,7 +200,7 @@ public class SelfBeneficiariesTPTWritePlatformServiceImpl implements
NAME_PARAM_NAME, name); NAME_PARAM_NAME, name);
} }
this.logger.error(dae.getMessage(), dae); this.logger.error("Error occured.", dae);
throw new PlatformDataIntegrityException( throw new PlatformDataIntegrityException(
"error.msg.beneficiary.unknown.data.integrity.issue", "error.msg.beneficiary.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
@@ -173,7 +173,7 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService
final int result = jdbcTemplate.update(updateSqlBuilder.toString()); final int result = jdbcTemplate.update(updateSqlBuilder.toString());
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by update: " + result); logger.info("{}: Results affected by update: {}", ThreadLocalContextUtil.getTenant().getName(), result);
} }
@Transactional @Transactional
@@ -208,7 +208,7 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService
final int result = jdbcTemplate.update(updateSqlBuilder.toString()); final int result = jdbcTemplate.update(updateSqlBuilder.toString());
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by update: " + result); logger.info("{}: Results affected by update: {}", ThreadLocalContextUtil.getTenant().getName(), result);
} }
@Override @Override
@@ -225,15 +225,14 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService
} catch (final PlatformApiDataValidationException e) { } catch (final PlatformApiDataValidationException e) {
final List<ApiParameterError> errors = e.getErrors(); final List<ApiParameterError> errors = e.getErrors();
for (final ApiParameterError error : errors) { for (final ApiParameterError error : errors) {
logger.error("Apply annual fee failed for account:" + savingsAccountReference.getAccountNo() + " with message " logger.error("Apply annual fee failed for account: {} with message {}", savingsAccountReference.getAccountNo(), error);
+ error.getDeveloperMessage());
} }
} catch (final Exception ex) { } catch (final Exception ex) {
// need to handle this scenario // need to handle this scenario
} }
} }
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Savings accounts affected by update: " + annualFeeData.size()); logger.info("{}: Savings accounts affected by update: {}", ThreadLocalContextUtil.getTenant().getName(), annualFeeData.size());
} }
@Override @Override
@@ -288,7 +287,7 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService
final int result = jdbcTemplate.update(updateSqlBuilder.toString()); final int result = jdbcTemplate.update(updateSqlBuilder.toString());
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by update: " + result); logger.info("{} : Results affected by update: {}", ThreadLocalContextUtil.getTenant().getName(), result);
} }
@Override @Override
@@ -304,15 +303,14 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService
} catch (final PlatformApiDataValidationException e) { } catch (final PlatformApiDataValidationException e) {
final List<ApiParameterError> errors = e.getErrors(); final List<ApiParameterError> errors = e.getErrors();
for (final ApiParameterError error : errors) { for (final ApiParameterError error : errors) {
logger.error("Update maturity details failed for account:" + depositAccount.accountNo() + " with message " logger.error("Update maturity details failed for account: {} with message {}", depositAccount.accountNo(), error.getDeveloperMessage());
+ error.getDeveloperMessage());
} }
} catch (final Exception ex) { } catch (final Exception ex) {
// need to handle this scenario // need to handle this scenario
} }
} }
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Deposit accounts affected by update: " + depositAccounts.size()); logger.info("{}: Deposit accounts affected by update: {}", ThreadLocalContextUtil.getTenant().getName(), depositAccounts.size());
} }
@Override @Override
@@ -392,7 +390,8 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService
} catch (final PlatformApiDataValidationException e) { } catch (final PlatformApiDataValidationException e) {
final List<ApiParameterError> errors = e.getErrors(); final List<ApiParameterError> errors = e.getErrors();
for (final ApiParameterError error : errors) { for (final ApiParameterError error : errors) {
logger.error("Post Dividends to savings failed due to ApiParameterError for Divident detail Id: {} and savings Id: {} with message: ", id, savingsId, error.getDeveloperMessage(), e); logger.error("Post Dividends to savings failed due to ApiParameterError for Divident detail Id: {} and savings Id: {} with message: {}",
new Object[] { id, savingsId, error.getDeveloperMessage(), e });
++numberOfErrors; ++numberOfErrors;
} }
} catch (final Exception e) { } catch (final Exception e) {
@@ -430,7 +429,7 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService
.append("group by je.account_id, je.office_id, je.transaction_date, Date(je.entry_date)"); .append("group by je.account_id, je.office_id, je.transaction_date, Date(je.entry_date)");
final int result = jdbcTemplate.update(sqlBuilder.toString(), formattedDate); final int result = jdbcTemplate.update(sqlBuilder.toString(), formattedDate);
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Results affected by update: " + result); logger.info("{}: Results affected by update: {}", ThreadLocalContextUtil.getTenant().getName(), result);
} }
// Updating closing balance // Updating closing balance
@@ -575,7 +575,7 @@ public class AppUser extends AbstractPersistableCustom<Long> implements Platform
public void validateHasPermissionTo(final String function) { public void validateHasPermissionTo(final String function) {
if (hasNotPermissionTo(function)) { if (hasNotPermissionTo(function)) {
final String authorizationMessage = "User has no authority to: " + function; final String authorizationMessage = "User has no authority to: " + function;
logger.info("Unauthorized access: userId: " + getId() + " action: " + function + " allowed: " + getAuthorities()); logger.info("Unauthorized access: userId: {} action: {} allowed: {}", new Object[] { getId(), function, getAuthorities() });
throw new NoAuthorizationException(authorizationMessage); throw new NoAuthorizationException(authorizationMessage);
} }
} }
@@ -351,7 +351,7 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit
throw new PlatformDataIntegrityException("error.msg.user.self.service.user.already.exist", "Self Service User Id is already created. Go to Admin->Users to edit or delete the self-service user."); throw new PlatformDataIntegrityException("error.msg.user.self.service.user.already.exist", "Self Service User Id is already created. Go to Admin->Users to edit or delete the self-service user.");
} }
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.unknown.data.integrity.issue", "Unknown data integrity issue with resource."); throw new PlatformDataIntegrityException("error.msg.unknown.data.integrity.issue", "Unknown data integrity issue with resource.");
} }
} }
@@ -88,7 +88,7 @@ public class PasswordPreferencesWritePlatformServiceJpaRepositoryImpl implements
.with(changes) // .with(changes) //
.build(); .build();
} catch (final DataIntegrityViolationException dve) { } catch (final DataIntegrityViolationException dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
throw new PlatformDataIntegrityException("error.msg.password.validation.policy.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.password.validation.policy.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -34,7 +34,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class PermissionReadPlatformServiceImpl implements PermissionReadPlatformService { public class PermissionReadPlatformServiceImpl implements PermissionReadPlatformService {
private final static Logger logger = LoggerFactory.getLogger(PermissionReadPlatformService.class); private final static Logger logger = LoggerFactory.getLogger(PermissionReadPlatformServiceImpl.class);
private final JdbcTemplate jdbcTemplate; private final JdbcTemplate jdbcTemplate;
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
@@ -52,7 +52,7 @@ public class PermissionReadPlatformServiceImpl implements PermissionReadPlatform
final PermissionUsageDataMapper mapper = new PermissionUsageDataMapper(); final PermissionUsageDataMapper mapper = new PermissionUsageDataMapper();
final String sql = mapper.permissionSchema(); final String sql = mapper.permissionSchema();
logger.info("retrieveAllPermissions: " + sql); logger.info("retrieveAllPermissions: {}", sql);
return this.jdbcTemplate.query(sql, mapper, new Object[] {}); return this.jdbcTemplate.query(sql, mapper, new Object[] {});
} }
@@ -63,7 +63,7 @@ public class PermissionReadPlatformServiceImpl implements PermissionReadPlatform
final PermissionUsageDataMapper mapper = new PermissionUsageDataMapper(); final PermissionUsageDataMapper mapper = new PermissionUsageDataMapper();
final String sql = mapper.makerCheckerablePermissionSchema(); final String sql = mapper.makerCheckerablePermissionSchema();
logger.info("retrieveAllMakerCheckerablePermissions: " + sql); logger.info("retrieveAllMakerCheckerablePermissions: {}", sql);
return this.jdbcTemplate.query(sql, mapper, new Object[] {}); return this.jdbcTemplate.query(sql, mapper, new Object[] {});
} }
@@ -73,7 +73,7 @@ public class PermissionReadPlatformServiceImpl implements PermissionReadPlatform
final PermissionUsageDataMapper mapper = new PermissionUsageDataMapper(); final PermissionUsageDataMapper mapper = new PermissionUsageDataMapper();
final String sql = mapper.rolePermissionSchema(); final String sql = mapper.rolePermissionSchema();
logger.info("retrieveAllRolePermissions: " + sql); logger.info("retrieveAllRolePermissions: {}", sql);
return this.jdbcTemplate.query(sql, mapper, new Object[] { roleId }); return this.jdbcTemplate.query(sql, mapper, new Object[] { roleId });
} }
@@ -118,7 +118,7 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) {
logger.error(dve.getMessage(), dve); logger.error("Error occured.", dve);
} }
@Caching(evict = { @CacheEvict(value = "users", allEntries = true), @CacheEvict(value = "usersByUsername", allEntries = true) }) @Caching(evict = { @CacheEvict(value = "users", allEntries = true), @CacheEvict(value = "usersByUsername", allEntries = true) })