details:   https://code.openbravo.com/erp/devel/pi/rev/1ce8df93a3fb
changeset: 32624:1ce8df93a3fb
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Wed Sep 06 11:07:49 2017 +0200
summary:   fixes bug 35944: unresponsive UI after error in 
EntityPersistenceEventObserver

  When an EntityPersistenceEventObserver failed with an uncaught error (ie. 
NPE), the UI became unresponsive after saving. This was happening due to a JS 
error when trying to set the error message in the view. Under this 
circumstances data can be undefined, and the error was thrown when trying to 
access data.data.

  That point of code was reached because the error message was not being 
handled properly when the message text returned by the server is an empty 
string. To fix the problem now we handle it and a generic error message is 
shown in this case.

  Besides, a security check has been added to ensure that data is not null when 
trying to access to data.data.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 1db6083af55b -r 1ce8df93a3fb 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 Wed Sep 06 08:58:05 2017 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 Wed Sep 06 11:07:49 2017 +0200
@@ -498,7 +498,7 @@
           isLabel = true;
           msg = error.message;
           params = error.params;
-        } else if (error.message) {
+        } else if (isc.isA.String(error.message)) {
           type = error.messageType || type;
           params = error.params;
           // error.messageType can be Error
@@ -513,7 +513,7 @@
         // hope that someone else will handle it
         return false;
       }
-    } else if (data.data) {
+    } else if (data && data.data) {
       // try it with data.data
       return this.setErrorMessageFromResponse(resp, data.data, req);
     } else {

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to