details: https://code.openbravo.com/erp/devel/pi/rev/359c62f9c661 changeset: 32288:359c62f9c661 user: Inigo Sanchez <inigo.sanchez <at> openbravo.com> date: Fri Jun 09 13:07:44 2017 +0200 summary: Related with issue 36109: code review improvements related with log
diffstat: src-db/database/sourcedata/AD_MESSAGE.xml | 12 ++++++++++++ src/org/openbravo/erpCommon/ad_process/DeleteClient.java | 5 ++--- src/org/openbravo/service/system/SystemService.java | 8 +++----- 3 files changed, 17 insertions(+), 8 deletions(-) diffs (68 lines): diff -r 28f9dc3eb943 -r 359c62f9c661 src-db/database/sourcedata/AD_MESSAGE.xml --- a/src-db/database/sourcedata/AD_MESSAGE.xml Fri Jun 09 12:20:20 2017 +0200 +++ b/src-db/database/sourcedata/AD_MESSAGE.xml Fri Jun 09 13:07:44 2017 +0200 @@ -20781,6 +20781,18 @@ <!--643C242A10AE4A4495EA6D82B99C1F86--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N> <!--643C242A10AE4A4495EA6D82B99C1F86--></AD_MESSAGE> +<!--6464673990AB4DB2A9CFD6860D839518--><AD_MESSAGE> +<!--6464673990AB4DB2A9CFD6860D839518--> <AD_MESSAGE_ID><![CDATA[6464673990AB4DB2A9CFD6860D839518]]></AD_MESSAGE_ID> +<!--6464673990AB4DB2A9CFD6860D839518--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--6464673990AB4DB2A9CFD6860D839518--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--6464673990AB4DB2A9CFD6860D839518--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--6464673990AB4DB2A9CFD6860D839518--> <VALUE><![CDATA[DeleteClient_ClientNotRemoved]]></VALUE> +<!--6464673990AB4DB2A9CFD6860D839518--> <MSGTEXT><![CDATA[The client is not removed because an exception is thrown while executing the delete queries.]]></MSGTEXT> +<!--6464673990AB4DB2A9CFD6860D839518--> <MSGTYPE><![CDATA[E]]></MSGTYPE> +<!--6464673990AB4DB2A9CFD6860D839518--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> +<!--6464673990AB4DB2A9CFD6860D839518--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N> +<!--6464673990AB4DB2A9CFD6860D839518--></AD_MESSAGE> + <!--64F35F2418B944BD88A146A3032D3717--><AD_MESSAGE> <!--64F35F2418B944BD88A146A3032D3717--> <AD_MESSAGE_ID><![CDATA[64F35F2418B944BD88A146A3032D3717]]></AD_MESSAGE_ID> <!--64F35F2418B944BD88A146A3032D3717--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff -r 28f9dc3eb943 -r 359c62f9c661 src/org/openbravo/erpCommon/ad_process/DeleteClient.java --- a/src/org/openbravo/erpCommon/ad_process/DeleteClient.java Fri Jun 09 12:20:20 2017 +0200 +++ b/src/org/openbravo/erpCommon/ad_process/DeleteClient.java Fri Jun 09 13:07:44 2017 +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) 2001-2010 Openbravo SLU + * All portions are Copyright (C) 2001-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -80,8 +80,7 @@ } } catch (Exception e) { myMessage = Utility.translateError(this, vars, vars.getLanguage(), e.getMessage()); - e.printStackTrace(); - log4j.warn("Error"); + log4j.error("Error while trying to delete a client.", e); } if (myMessage == null) { myMessage = new OBError(); diff -r 28f9dc3eb943 -r 359c62f9c661 src/org/openbravo/service/system/SystemService.java --- a/src/org/openbravo/service/system/SystemService.java Fri Jun 09 12:20:20 2017 +0200 +++ b/src/org/openbravo/service/system/SystemService.java Fri Jun 09 13:07:44 2017 +0200 @@ -342,17 +342,15 @@ ps.setString(1, clientId); ps.executeUpdate(); } catch (Exception e) { - throw new RuntimeException("Exception when executing the delete queries.", e); + throw new RuntimeException("Exception when executing the following query: " + command, e); } } con.commit(); } catch (Exception e) { - log4j.error("Exception when deleting the client: ", e); + log4j.error("Exception when deleting the client " + clientId, e); OBDal.getInstance().rollbackAndClose(); - throw new RuntimeException( - "The client is not removed because an exception is thrown while executing the delete queries. ", - e); + throw new RuntimeException("@DeleteClient_ClientNotRemoved@", e); } finally { OBDal.getInstance().commitAndClose(); enableConstraints(platform); ------------------------------------------------------------------------------ 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