This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit b33247add1f31176c102d70d79bd83c4e6135991 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Jun 4 15:20:22 2015 +0200 fixes #1236 : afficher les exceptions métier --- .../org/chorem/lima/business/ejb/ImportServiceImpl.java | 13 +++++++++++-- .../java/org/chorem/lima/ui/importexport/ImportExport.java | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java index 15b5628..fe199e0 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java @@ -63,6 +63,7 @@ import org.chorem.lima.business.exceptions.BeginAfterEndFiscalPeriodException; import org.chorem.lima.business.exceptions.ImportEbpException; import org.chorem.lima.business.exceptions.ImportFileException; import org.chorem.lima.business.exceptions.InvalidAccountNumberException; +import org.chorem.lima.business.exceptions.LimaException; import org.chorem.lima.business.exceptions.LockedEntryBookException; import org.chorem.lima.business.exceptions.LockedFinancialPeriodException; import org.chorem.lima.business.exceptions.MoreOneUnlockFiscalPeriodException; @@ -320,7 +321,11 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ financialTransactionService.createFinancialTransaction(financialTransaction); } } catch (Exception e) { - result.addInitException(new ImportFileException(e.getMessage())); + if (e instanceof LimaException) { + result.addInitException((LimaException) e); + } else { + result.addInitException(new ImportFileException(e.getMessage())); + } results.setErrors(true); } finally { IOUtils.closeQuietly(contentStream); @@ -347,7 +352,11 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ result.increaseCreated(); } } catch (Exception e) { - result.addInitException(new ImportFileException(e.getMessage())); + if (e instanceof LimaException) { + result.addInitException((LimaException) e); + } else { + result.addInitException(new ImportFileException(e.getMessage())); + } results.setErrors(true); } finally { IOUtils.closeQuietly(contentStream); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java index fa1d8c3..526bfa7 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java @@ -36,8 +36,10 @@ import org.chorem.lima.business.ImportResult; import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.api.ExportService; import org.chorem.lima.business.api.ImportService; +import org.chorem.lima.business.exceptions.AfterLastFiscalPeriodException; import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatementException; import org.chorem.lima.business.exceptions.AlreadyExistVatStatementException; +import org.chorem.lima.business.exceptions.BeforeFirstFiscalPeriodException; import org.chorem.lima.business.exceptions.BeginAfterEndFiscalPeriodException; import org.chorem.lima.business.exceptions.ImportFileException; import org.chorem.lima.business.exceptions.InvalidAccountNumberException; @@ -451,6 +453,10 @@ public class ImportExport { result.append(t("lima.vatStatement.error.alreadyExistVatStatement", ((AlreadyExistVatStatementException) importException).getVatStatementLabel()) + "\n"); } else if (importException instanceof NoFiscalPeriodFoundException) { result.append(t("lima.error.noFiscalPeriodFound") + "\n"); + } else if (importException instanceof BeforeFirstFiscalPeriodException) { + result.append(t("lima.entries.add.transaction.error.beforeFirstFiscalPeriod", ((BeforeFirstFiscalPeriodException) importException).getDate()) + "\n"); + } else if (importException instanceof AfterLastFiscalPeriodException) { + result.append(t("lima.entries.add.transaction.error.afterLastFiscalPeriod", ((AfterLastFiscalPeriodException) importException).getDate()) + "\n"); } else if (importException instanceof NoDataToImportException) { errorHelper.showErrorMessage(t("lima.import.error.noDataToImport")); log.warn(t("lima.import.error.noDataToImport")); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.