details: https://code.openbravo.com/erp/devel/pi/rev/97100140eab3 changeset: 34478:97100140eab3 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Thu Aug 02 13:19:02 2018 +0200 summary: fixes issue 38855: Error shown in Purchase Order Report is not user friendly
diffstat: modules/org.openbravo.client.application/src/org/openbravo/client/application/report/BaseReportActionHandler.java | 4 +++- src/org/openbravo/service/db/DbUtility.java | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diffs (49 lines): diff -r f78e4433d0cc -r 97100140eab3 modules/org.openbravo.client.application/src/org/openbravo/client/application/report/BaseReportActionHandler.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/report/BaseReportActionHandler.java Thu Aug 02 13:16:08 2018 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/report/BaseReportActionHandler.java Thu Aug 02 13:19:02 2018 +0200 @@ -69,6 +69,7 @@ import org.openbravo.database.ConnectionProvider; import org.openbravo.database.SessionInfo; import org.openbravo.erpCommon.utility.OBMessageUtils; +import org.openbravo.service.db.DbUtility; import org.openbravo.userinterface.selector.reference.FKMultiSelectorUIDefinition; import org.openbravo.utils.FileUtility; import org.slf4j.Logger; @@ -130,11 +131,12 @@ return result; } catch (Exception e) { log.error("Error generating report id: {}", parameters.get("reportId"), e); + Throwable uiException = DbUtility.getUnderlyingSQLException(e); return getResponseBuilder() .retryExecution() .showResultsInProcessView() .showMsgInProcessView(MessageType.ERROR, - OBMessageUtils.translateError(e.getMessage()).getMessage()).build(); + OBMessageUtils.translateError(uiException.getMessage()).getMessage()).build(); } } diff -r f78e4433d0cc -r 97100140eab3 src/org/openbravo/service/db/DbUtility.java --- a/src/org/openbravo/service/db/DbUtility.java Thu Aug 02 13:16:08 2018 +0200 +++ b/src/org/openbravo/service/db/DbUtility.java Thu Aug 02 13:19:02 2018 +0200 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2008-2010 Openbravo SLU + * All portions are Copyright (C) 2008-2018 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -72,6 +72,11 @@ .getCause(); return cve.getSQLException().getNextException(); } + + if (throwable.getCause() instanceof SQLException) { + return throwable.getCause(); + } + return throwable; } ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits