details:   https://code.openbravo.com/erp/devel/pi/rev/af32d2655e73
changeset: 17975:af32d2655e73
user:      David Miguelez <david.miguelez <at> openbravo.com>
date:      Tue Sep 18 16:50:46 2012 +0200
summary:   Related to issue 21596: Shows message when fails.

diffstat:

 src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java    |  19 
++++++++++
 src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java |  19 
++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diffs (89 lines):

diff -r 292bdf82cd53 -r af32d2655e73 
src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java
--- a/src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java  Thu Sep 
13 19:27:19 2012 +0200
+++ b/src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java  Tue Sep 
18 16:50:46 2012 +0200
@@ -27,15 +27,19 @@
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import org.openbravo.base.provider.OBProvider;
+import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.client.application.process.BaseProcessActionHandler;
+import org.openbravo.client.kernel.RequestContext;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBDao;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.model.common.enterprise.Locator;
 import org.openbravo.model.common.order.OrderLine;
 import org.openbravo.model.materialmgmt.transaction.ShipmentInOut;
 import org.openbravo.model.materialmgmt.transaction.ShipmentInOutLine;
 import org.openbravo.model.sales.ConditionGoods;
+import org.openbravo.service.db.DbUtility;
 
 /**
  * 
@@ -66,6 +70,21 @@
 
     } catch (Exception e) {
       log.error(e.getMessage(), e);
+      VariablesSecureApp vars = RequestContext.get().getVariablesSecureApp();
+
+      try {
+        jsonRequest = new JSONObject();
+        Throwable ex = DbUtility.getUnderlyingSQLException(e);
+        String message = 
OBMessageUtils.translateError(ex.getMessage()).getMessage();
+        JSONObject errorMessage = new JSONObject();
+        errorMessage.put("severity", "error");
+        errorMessage.put("text", message);
+        jsonRequest.put("message", errorMessage);
+
+      } catch (Exception e2) {
+        log.error(e.getMessage(), e2);
+        // do nothing, give up
+      }
     } finally {
       OBContext.restorePreviousMode();
     }
diff -r 292bdf82cd53 -r af32d2655e73 
src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java
--- a/src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java       
Thu Sep 13 19:27:19 2012 +0200
+++ b/src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java       
Tue Sep 18 16:50:46 2012 +0200
@@ -28,14 +28,18 @@
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import org.openbravo.base.provider.OBProvider;
+import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.client.application.process.BaseProcessActionHandler;
+import org.openbravo.client.kernel.RequestContext;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBDao;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.model.common.enterprise.Locator;
 import org.openbravo.model.common.order.OrderLine;
 import org.openbravo.model.materialmgmt.transaction.ShipmentInOut;
 import org.openbravo.model.materialmgmt.transaction.ShipmentInOutLine;
+import org.openbravo.service.db.DbUtility;
 
 /**
  * 
@@ -67,6 +71,21 @@
 
     } catch (Exception e) {
       log.error(e.getMessage(), e);
+      VariablesSecureApp vars = RequestContext.get().getVariablesSecureApp();
+
+      try {
+        jsonRequest = new JSONObject();
+        Throwable ex = DbUtility.getUnderlyingSQLException(e);
+        String message = 
OBMessageUtils.translateError(ex.getMessage()).getMessage();
+        JSONObject errorMessage = new JSONObject();
+        errorMessage.put("severity", "error");
+        errorMessage.put("text", message);
+        jsonRequest.put("message", errorMessage);
+
+      } catch (Exception e2) {
+        log.error(e.getMessage(), e2);
+        // do nothing, give up
+      }
     } finally {
       OBContext.restorePreviousMode();
     }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to