diff --git a/fineract-provider/config/checkstyle/checkstyle.xml b/fineract-provider/config/checkstyle/checkstyle.xml
index 5720b78a5..b94e3f803 100644
--- a/fineract-provider/config/checkstyle/checkstyle.xml
+++ b/fineract-provider/config/checkstyle/checkstyle.xml
@@ -50,6 +50,7 @@
+
@@ -189,7 +190,7 @@
-
+
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/service/AccrualAccountingWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/service/AccrualAccountingWritePlatformServiceImpl.java
index 4584410db..f20bcf028 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/service/AccrualAccountingWritePlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/service/AccrualAccountingWritePlatformServiceImpl.java
@@ -61,7 +61,7 @@ public class AccrualAccountingWritePlatformServiceImpl implements AccrualAccount
.resource(PERIODIC_ACCRUAL_ACCOUNTING_RESOURCE_NAME);
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode(PERIODIC_ACCRUAL_ACCOUNTING_EXECUTION_ERROR_CODE,
e.getMessage());
- throw new PlatformApiDataValidationException(dataValidationErrors);
+ throw new PlatformApiDataValidationException(dataValidationErrors, e);
}
return CommandProcessingResult.empty();
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/exception/GLClosureNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/exception/GLClosureNotFoundException.java
index 92fa3f5d9..fab656449 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/exception/GLClosureNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/exception/GLClosureNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.accounting.closure.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when GL account closure resources are not found.
@@ -28,4 +29,8 @@ public class GLClosureNotFoundException extends AbstractPlatformResourceNotFound
public GLClosureNotFoundException(final Long id) {
super("error.msg.glclosure.id.invalid", "Accounting Closure with identifier " + id + " does not exist", id);
}
+
+ public GLClosureNotFoundException(final Long id, EmptyResultDataAccessException e) {
+ super("error.msg.glclosure.id.invalid", "Accounting Closure with identifier " + id + " does not exist", id, e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureReadPlatformServiceImpl.java
index 5f652aae9..a875f2e0b 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureReadPlatformServiceImpl.java
@@ -106,7 +106,7 @@ public class GLClosureReadPlatformServiceImpl implements GLClosureReadPlatformSe
return glAccountData;
} catch (final EmptyResultDataAccessException e) {
- throw new GLClosureNotFoundException(glClosureId);
+ throw new GLClosureNotFoundException(glClosureId, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/exception/FinancialActivityAccountNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/exception/FinancialActivityAccountNotFoundException.java
index e6350be58..6f18f84a9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/exception/FinancialActivityAccountNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/exception/FinancialActivityAccountNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.accounting.financialactivityaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when product to GL account mapping are not found.
@@ -29,6 +30,10 @@ public class FinancialActivityAccountNotFoundException extends AbstractPlatformR
super("error.msg.financialActivityAccount.not.found", "Financial Activity account with Id " + id + " does not exist", id);
}
+ public FinancialActivityAccountNotFoundException(final Long id, EmptyResultDataAccessException e) {
+ super("error.msg.financialActivityAccount.not.found", "Financial Activity account with Id " + id + " does not exist", id, e);
+ }
+
public FinancialActivityAccountNotFoundException(final Integer financialActivityType) {
super("error.msg.financialActivityAccount.not.found",
"Financial Activity account with for the financial Activity with Id " + financialActivityType + " does not exist",
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountReadPlatformServiceImpl.java
index 3937de1c3..e55256c3c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountReadPlatformServiceImpl.java
@@ -67,7 +67,7 @@ public class FinancialActivityAccountReadPlatformServiceImpl implements Financia
return this.jdbcTemplate.queryForObject(sqlBuilder.toString(), this.financialActivityAccountMapper,
new Object[] { financialActivityAccountId });
} catch (final EmptyResultDataAccessException e) {
- throw new FinancialActivityAccountNotFoundException(financialActivityAccountId);
+ throw new FinancialActivityAccountNotFoundException(financialActivityAccountId, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountNotFoundException.java
index 9e4d63ccf..01b7c6322 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when GL account resources are not found.
@@ -28,4 +29,8 @@ public class GLAccountNotFoundException extends AbstractPlatformResourceNotFound
public GLAccountNotFoundException(final Long id) {
super("error.msg.glaccount.id.invalid", "General Ledger account with identifier " + id + " does not exist ", id);
}
+
+ public GLAccountNotFoundException(final Long id, EmptyResultDataAccessException e) {
+ super("error.msg.glaccount.id.invalid", "General Ledger account with identifier " + id + " does not exist ", id, e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java
index 893f4d05e..6c40a4fce 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java
@@ -224,7 +224,7 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe
return glAccountData;
} catch (final EmptyResultDataAccessException e) {
- throw new GLAccountNotFoundException(glAccountId);
+ throw new GLAccountNotFoundException(glAccountId, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/exception/JournalEntriesNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/exception/JournalEntriesNotFoundException.java
index 44778e71e..7ff6baf78 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/exception/JournalEntriesNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/exception/JournalEntriesNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.accounting.journalentry.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when journal entry resources are not found.
@@ -34,4 +35,8 @@ public class JournalEntriesNotFoundException extends AbstractPlatformResourceNot
public JournalEntriesNotFoundException(final Long entryId) {
super("error.msg.journalEntries.id.invalid", "Journal Entry with entry Id " + entryId + " does not exist ", entryId);
}
+
+ public JournalEntriesNotFoundException(final Long entryId, EmptyResultDataAccessException e) {
+ super("error.msg.journalEntries.id.invalid", "Journal Entry with entry Id " + entryId + " does not exist ", entryId, e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java
index 56e322123..86e70ee2b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java
@@ -391,7 +391,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
return glJournalEntryData;
} catch (final EmptyResultDataAccessException e) {
- throw new JournalEntriesNotFoundException(glJournalEntryId);
+ throw new JournalEntriesNotFoundException(glJournalEntryId, e);
}
}
@@ -534,7 +534,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
Object[] data = { transactionId, entityId, entityType };
return this.paginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sql, data, rm);
} catch (final EmptyResultDataAccessException e) {
- throw new JournalEntriesNotFoundException(entityId);
+ throw new JournalEntriesNotFoundException(entityId, e);
}
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleNotFoundException.java
index 0768b46a3..c32d47ba9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.accounting.rule.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when Accounting rule resources are not found.
@@ -28,4 +29,8 @@ public class AccountingRuleNotFoundException extends AbstractPlatformResourceNot
public AccountingRuleNotFoundException(final Long id) {
super("error.msg.accounting.rule.id.invalid", "Accounting Rule with identifier " + id + " does not exist", id);
}
+
+ public AccountingRuleNotFoundException(final Long id, EmptyResultDataAccessException e) {
+ super("error.msg.accounting.rule.id.invalid", "Accounting Rule with identifier " + id + " does not exist", id, e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java
index 2a54cad81..94f906ae2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java
@@ -184,7 +184,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead
}
return accountingRuleData;
} catch (final EmptyResultDataAccessException e) {
- throw new AccountingRuleNotFoundException(accountingRuleId);
+ throw new AccountingRuleNotFoundException(accountingRuleId, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/exception/AdHocNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/exception/AdHocNotFoundException.java
index e30cf213f..50de8b40c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/exception/AdHocNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/exception/AdHocNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.adhocquery.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when AdHoc resources are not found.
@@ -28,4 +29,8 @@ public class AdHocNotFoundException extends AbstractPlatformResourceNotFoundExce
public AdHocNotFoundException(final Long id) {
super("error.msg.adhocquery.adhoc.id.invalid", "Adhoc Record with identifier " + id + " does not exist", id);
}
+
+ public AdHocNotFoundException(final Long id, EmptyResultDataAccessException e) {
+ super("error.msg.adhocquery.adhoc.id.invalid", "Adhoc Record with identifier " + id + " does not exist", id, e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocReadPlatformServiceImpl.java
index 16492b0eb..4204934d0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocReadPlatformServiceImpl.java
@@ -66,7 +66,7 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
return this.jdbcTemplate.queryForObject(sql, this.adHocRowMapper, new Object[] { id });
} catch (final EmptyResultDataAccessException e) {
- throw new AdHocNotFoundException(id);
+ throw new AdHocNotFoundException(id, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocWritePlatformServiceJpaRepositoryImpl.java
index cd5861276..33d39303a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocWritePlatformServiceJpaRepositoryImpl.java
@@ -139,7 +139,7 @@ public class AdHocWritePlatformServiceJpaRepositoryImpl implements AdHocWritePla
return new CommandProcessingResultBuilder().withEntityId(adHocId).build();
} catch (final DataIntegrityViolationException e) {
throw new PlatformDataIntegrityException("error.msg.unknown.data.integrity.issue",
- "Unknown data integrity issue with resource: " + e.getMostSpecificCause());
+ "Unknown data integrity issue with resource: " + e.getMostSpecificCause(), e);
}
}
@@ -160,7 +160,7 @@ public class AdHocWritePlatformServiceJpaRepositoryImpl implements AdHocWritePla
} catch (final DataIntegrityViolationException e) {
throw new PlatformDataIntegrityException("error.msg.unknown.data.integrity.issue",
- "Unknown data integrity issue with resource: " + e.getMostSpecificCause());
+ "Unknown data integrity issue with resource: " + e.getMostSpecificCause(), e);
}
}
@@ -181,7 +181,7 @@ public class AdHocWritePlatformServiceJpaRepositoryImpl implements AdHocWritePla
} catch (final DataIntegrityViolationException e) {
throw new PlatformDataIntegrityException("error.msg.unknown.data.integrity.issue",
- "Unknown data integrity issue with resource: " + e.getMostSpecificCause());
+ "Unknown data integrity issue with resource: " + e.getMostSpecificCause(), e);
}
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java
index aea732f6e..3beab9e73 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java
@@ -64,6 +64,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
}
@Override
+ @SuppressWarnings("AvoidHidingCauseException")
public CommandProcessingResult logCommandSource(final CommandWrapper wrapper) {
boolean isApprovedByChecker = false;
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/exception/AccountNumberFormatNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/exception/AccountNumberFormatNotFoundException.java
index 45d713b92..b9f7c9ab6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/exception/AccountNumberFormatNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/exception/AccountNumberFormatNotFoundException.java
@@ -20,6 +20,7 @@ package org.apache.fineract.infrastructure.accountnumberformat.exception;
import org.apache.fineract.infrastructure.accountnumberformat.service.AccountNumberFormatConstants;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when client resources are not found.
@@ -31,4 +32,9 @@ public class AccountNumberFormatNotFoundException extends AbstractPlatformResour
"AccountNumber format with identifier " + id + " does not exist", id);
}
+ public AccountNumberFormatNotFoundException(final Long id, EmptyResultDataAccessException e) {
+ super(AccountNumberFormatConstants.EXCEPTION_ACCOUNT_NUMBER_FORMAT_NOT_FOUND,
+ "AccountNumber format with identifier " + id + " does not exist", id, e);
+ }
+
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatReadPlatformServiceImpl.java
index d79fe7c8a..ff8c298a6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatReadPlatformServiceImpl.java
@@ -101,7 +101,7 @@ public class AccountNumberFormatReadPlatformServiceImpl implements AccountNumber
new Object[] { id });
return accountNumberFormatData;
} catch (final EmptyResultDataAccessException e) {
- throw new AccountNumberFormatNotFoundException(id);
+ throw new AccountNumberFormatNotFoundException(id, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java
index 59c58d323..e9148c584 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java
@@ -85,7 +85,7 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
row.createCell(colIndex).setCellValue(dateWithoutTime);
row.getCell(colIndex).setCellStyle(dateCellStyle);
} catch (ParseException pe) {
- throw new IllegalArgumentException("ParseException");
+ throw new IllegalArgumentException(pe);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookServiceImpl.java
index d215567be..c6de1668f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/service/BulkImportWorkbookServiceImpl.java
@@ -176,7 +176,7 @@ public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService
} catch (IOException e) {
LOG.error("Problem occurred in importWorkbook function", e);
throw new GeneralPlatformDomainRuleException("error.msg.io.exception",
- "IO exception occured with " + fileDetail.getFileName() + " " + e.getMessage());
+ "IO exception occured with " + fileDetail.getFileName() + " " + e.getMessage(), e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailBusinessRuleNotFound.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailBusinessRuleNotFound.java
index c29122e29..dae6f5e13 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailBusinessRuleNotFound.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailBusinessRuleNotFound.java
@@ -26,4 +26,9 @@ public class EmailBusinessRuleNotFound extends AbstractPlatformResourceNotFoundE
super("error.msg.email.business.rule.not.found", "Email business rule with identifier `" + resourceId + "` does not exist",
resourceId);
}
+
+ public EmailBusinessRuleNotFound(final Long resourceId, IndexOutOfBoundsException e) {
+ super("error.msg.email.business.rule.not.found", "Email business rule with identifier `" + resourceId + "` does not exist",
+ resourceId, e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailCampaignNotFound.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailCampaignNotFound.java
index 0682e9324..f8ceeaced 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailCampaignNotFound.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailCampaignNotFound.java
@@ -19,6 +19,7 @@
package org.apache.fineract.infrastructure.campaigns.email.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
public class EmailCampaignNotFound extends AbstractPlatformResourceNotFoundException {
@@ -26,4 +27,9 @@ public class EmailCampaignNotFound extends AbstractPlatformResourceNotFoundExcep
super("error.msg.email.campaign.identifier.not.found", "EMAIL_CAMPAIGN with identifier `" + resourceId + "` does not exist",
resourceId);
}
+
+ public EmailCampaignNotFound(final Long resourceId, EmptyResultDataAccessException e) {
+ super("error.msg.email.campaign.identifier.not.found", "EMAIL_CAMPAIGN with identifier `" + resourceId + "` does not exist",
+ resourceId, e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailConfigurationNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailConfigurationNotFoundException.java
index 2f8234b28..899bc9c0d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailConfigurationNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailConfigurationNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.infrastructure.campaigns.email.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when a code is not found.
@@ -28,4 +29,9 @@ public class EmailConfigurationNotFoundException extends AbstractPlatformResourc
public EmailConfigurationNotFoundException(final String name) {
super("error.msg.email.configuration.name.not.found", "Email configuration with name " + name + " does not exist", name);
}
+
+ public EmailConfigurationNotFoundException(String name, EmptyResultDataAccessException e) {
+ super("error.msg.email.configuration.name.not.found", "Email configuration with name " + name + " does not exist", name, e);
+ }
+
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailNotFoundException.java
index 6e726b36c..5506da775 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/exception/EmailNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.infrastructure.campaigns.email.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when a code is not found.
@@ -28,4 +29,8 @@ public class EmailNotFoundException extends AbstractPlatformResourceNotFoundExce
public EmailNotFoundException(final Long resourceId) {
super("error.msg.email.identifier.not.found", "Email with identifier `" + resourceId + "` does not exist", resourceId);
}
+
+ public EmailNotFoundException(Long resourceId, EmptyResultDataAccessException e) {
+ super("error.msg.email.identifier.not.found", "Email with identifier `" + resourceId + "` does not exist", resourceId, e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignReadPlatformServiceImpl.java
index e56d988e0..ff0a8727d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignReadPlatformServiceImpl.java
@@ -246,7 +246,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
EmailBusinessRulesData emailBusinessRulesData = retrieveOne.get(0);
return emailBusinessRulesData;
} catch (final IndexOutOfBoundsException e) {
- throw new EmailBusinessRuleNotFound(resourceId);
+ throw new EmailBusinessRuleNotFound(resourceId, e);
}
}
@@ -258,7 +258,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
final String sql = "select " + this.emailCampaignMapper.schema + " where ec.id = ? and ec.is_visible = ?";
return this.jdbcTemplate.queryForObject(sql, this.emailCampaignMapper, resourceId, isVisible);
} catch (final EmptyResultDataAccessException e) {
- throw new EmailCampaignNotFound(resourceId);
+ throw new EmailCampaignNotFound(resourceId, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailConfigurationReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailConfigurationReadPlatformServiceImpl.java
index 9dfc55052..1ddd2afd3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailConfigurationReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailConfigurationReadPlatformServiceImpl.java
@@ -91,7 +91,7 @@ public class EmailConfigurationReadPlatformServiceImpl implements EmailConfigura
catch (final EmptyResultDataAccessException e) {
- throw new EmailConfigurationNotFoundException(name);
+ throw new EmailConfigurationNotFoundException(name, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailReadPlatformServiceImpl.java
index e7fd91674..0f1d7633a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailReadPlatformServiceImpl.java
@@ -123,7 +123,7 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
return this.jdbcTemplate.queryForObject(sql, this.emailRowMapper, resourceId);
} catch (final EmptyResultDataAccessException e) {
- throw new EmailNotFoundException(resourceId);
+ throw new EmailNotFoundException(resourceId, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/exception/ConnectionFailureException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/exception/ConnectionFailureException.java
index 0a37f881c..5e6217a2e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/exception/ConnectionFailureException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/exception/ConnectionFailureException.java
@@ -27,4 +27,9 @@ public class ConnectionFailureException extends AbstractPlatformServiceUnavailab
"Unable to connect to the server with connection name - " + connectionName, connectionName);
}
+ public ConnectionFailureException(String connectionName, Exception e) {
+ super("error.msg.unable.to.connect.to.intermediate.server",
+ "Unable to connect to the server with connection name - " + connectionName, connectionName, e);
+ }
+
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/exception/SmsCampaignNotFound.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/exception/SmsCampaignNotFound.java
index a51bccf82..539488d4b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/exception/SmsCampaignNotFound.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/exception/SmsCampaignNotFound.java
@@ -19,6 +19,7 @@
package org.apache.fineract.infrastructure.campaigns.sms.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
public class SmsCampaignNotFound extends AbstractPlatformResourceNotFoundException {
@@ -26,4 +27,9 @@ public class SmsCampaignNotFound extends AbstractPlatformResourceNotFoundExcepti
super("error.msg.sms.campaign.identifier.not.found", "Sms Campaign with identifier `" + resourceId + "` does not exist",
resourceId);
}
+
+ public SmsCampaignNotFound(final Long resourceId, EmptyResultDataAccessException e) {
+ super("error.msg.sms.campaign.identifier.not.found", "Sms Campaign with identifier `" + resourceId + "` does not exist", resourceId,
+ e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignReadPlatformServiceImpl.java
index 6fde3c550..1b7342998 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignReadPlatformServiceImpl.java
@@ -79,7 +79,7 @@ public class SmsCampaignReadPlatformServiceImpl implements SmsCampaignReadPlatfo
final String sql = "select " + this.smsCampaignMapper.schema + " where sc.id = ? and sc.is_visible = ?";
return this.jdbcTemplate.queryForObject(sql, this.smsCampaignMapper, new Object[] { campaignId, isVisible });
} catch (final EmptyResultDataAccessException e) {
- throw new SmsCampaignNotFound(campaignId);
+ throw new SmsCampaignNotFound(campaignId, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/exception/CodeNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/exception/CodeNotFoundException.java
index b277c6182..874ec799c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/exception/CodeNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/exception/CodeNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.infrastructure.codes.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when a code is not found.
@@ -32,4 +33,13 @@ public class CodeNotFoundException extends AbstractPlatformResourceNotFoundExcep
public CodeNotFoundException(final Long codeId) {
super("error.msg.code.identifier.not.found", "Code with identifier `" + codeId + "` does not exist", codeId);
}
+
+ public CodeNotFoundException(final String name, EmptyResultDataAccessException e) {
+ super("error.msg.code.not.found", "Code with name `" + name + "` does not exist", name, e);
+ }
+
+ public CodeNotFoundException(final Long codeId, EmptyResultDataAccessException e) {
+ super("error.msg.code.identifier.not.found", "Code with identifier `" + codeId + "` does not exist", codeId, e);
+ }
+
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/exception/CodeValueNotFoundException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/exception/CodeValueNotFoundException.java
index ef5f10fcd..fc9b85666 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/exception/CodeValueNotFoundException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/exception/CodeValueNotFoundException.java
@@ -19,6 +19,7 @@
package org.apache.fineract.infrastructure.codes.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+import org.springframework.dao.EmptyResultDataAccessException;
/**
* A {@link RuntimeException} thrown when client resources are not found.
@@ -38,4 +39,8 @@ public class CodeValueNotFoundException extends AbstractPlatformResourceNotFound
super("error.msg.codevalue.codename.id.combination.invalid",
"Code value with label " + label + " does not exist for a code with name " + codeName, label, codeName);
}
+
+ public CodeValueNotFoundException(Long id, EmptyResultDataAccessException e) {
+ super("error.msg.codevalue.id.invalid", "Code value with identifier " + id + " does not exist", id, e);
+ }
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeReadPlatformServiceImpl.java
index 19bc39c18..dbcd89c5f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeReadPlatformServiceImpl.java
@@ -82,7 +82,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeId });
} catch (final EmptyResultDataAccessException e) {
- throw new CodeNotFoundException(codeId);
+ throw new CodeNotFoundException(codeId, e);
}
}
@@ -96,7 +96,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeName });
} catch (final EmptyResultDataAccessException e) {
- throw new CodeNotFoundException(codeName);
+ throw new CodeNotFoundException(codeName, e);
}
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeValueReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeValueReadPlatformServiceImpl.java
index cc38bed79..a81e68a98 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeValueReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeValueReadPlatformServiceImpl.java
@@ -99,7 +99,7 @@ public class CodeValueReadPlatformServiceImpl implements CodeValueReadPlatformSe
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeValueId });
} catch (final EmptyResultDataAccessException e) {
- throw new CodeValueNotFoundException(codeValueId);
+ throw new CodeValueNotFoundException(codeValueId, e);
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeValueWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeValueWritePlatformServiceJpaRepositoryImpl.java
index e06e52a28..2cd959153 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeValueWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeValueWritePlatformServiceJpaRepositoryImpl.java
@@ -161,10 +161,10 @@ public class CodeValueWritePlatformServiceJpaRepositoryImpl implements CodeValue
LOG.error("Error occured.", dve);
final Throwable realCause = dve.getMostSpecificCause();
if (realCause.getMessage().contains("code_value")) {
- throw new PlatformDataIntegrityException("error.msg.codeValue.in.use", "This code value is in use", codeValueId);
+ throw new PlatformDataIntegrityException("error.msg.codeValue.in.use", "This code value is in use", codeValueId, dve);
}
throw new PlatformDataIntegrityException("error.msg.code.value.unknown.data.integrity.issue",
- "Unknown data integrity issue with resource: " + dve.getMostSpecificCause().getMessage());
+ "Unknown data integrity issue with resource: " + dve.getMostSpecificCause().getMessage(), dve);
}
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java
index f0b860dd1..a798a3dd7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java
@@ -129,7 +129,7 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
this.codeRepository.flush();
} catch (final DataIntegrityViolationException e) {
throw new PlatformDataIntegrityException("error.msg.cund.unknown.data.integrity.issue",
- "Unknown data integrity issue with resource: " + e.getMostSpecificCause());
+ "Unknown data integrity issue with resource: " + e.getMostSpecificCause(), e);
}
return new CommandProcessingResultBuilder().withEntityId(codeId).build();
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/AbstractPlatformException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/AbstractPlatformException.java
new file mode 100644
index 000000000..8eeb8b53c
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/AbstractPlatformException.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.infrastructure.core.exception;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class AbstractPlatformException {
+
+ protected static Throwable findThrowableCause(Object[] defaultUserMessageArgs) {
+ for (Object defaultUserMessageArg : defaultUserMessageArgs) {
+ if (defaultUserMessageArg instanceof Throwable) {
+ return (Throwable) defaultUserMessageArg;
+ }
+ }
+ return null;
+ }
+
+ protected static Object[] filterThrowableCause(Object[] defaultUserMessageArgs) {
+ List