details:   https://code.openbravo.com/erp/devel/pi/rev/120b7e711081
changeset: 32583:120b7e711081
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Thu Aug 24 13:55:10 2017 +0200
summary:   fixes bug 36706: Unreadable error if lose Internet connection on 
module install

 Now a readable error message is displayed to the user if the Internet 
connection is lost when trying to install a module.

diffstat:

 src-db/database/sourcedata/AD_MESSAGE.xml                  |  12 ++++++++++++
 src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java |   9 +++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diffs (49 lines):

diff -r 80ab9332dfc5 -r 120b7e711081 src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Thu Aug 24 12:12:26 2017 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Thu Aug 24 13:55:10 2017 +0200
@@ -17362,6 +17362,18 @@
 <!--203AD342E9F9458082388087B6B2B9BC-->  
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--203AD342E9F9458082388087B6B2B9BC--></AD_MESSAGE>
 
+<!--20BB880A0C7D4D158A96EF7C36AE29E2--><AD_MESSAGE>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2-->  
<AD_MESSAGE_ID><![CDATA[20BB880A0C7D4D158A96EF7C36AE29E2]]></AD_MESSAGE_ID>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2-->  
<VALUE><![CDATA[CR_CouldNotConnect]]></VALUE>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2-->  <MSGTEXT><![CDATA[Could not connect 
to the Central Repository.]]></MSGTEXT>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2-->  
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--20BB880A0C7D4D158A96EF7C36AE29E2--></AD_MESSAGE>
+
 <!--21376B83DE3746328CD8884CD493225C--><AD_MESSAGE>
 <!--21376B83DE3746328CD8884CD493225C-->  
<AD_MESSAGE_ID><![CDATA[21376B83DE3746328CD8884CD493225C]]></AD_MESSAGE_ID>
 <!--21376B83DE3746328CD8884CD493225C-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 80ab9332dfc5 -r 120b7e711081 
src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java
--- a/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java        Thu Aug 
24 12:12:26 2017 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ModuleManagement.java        Thu Aug 
24 13:55:10 2017 +0200
@@ -23,7 +23,9 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
+import java.net.ConnectException;
 import java.net.URL;
+import java.net.UnknownHostException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -1386,6 +1388,13 @@
       }
     } catch (final Exception e) {
       log4j.error(e.getMessage(), e);
+      Throwable cause = e.getCause();
+      if (cause instanceof ConnectException || cause instanceof 
UnknownHostException) {
+        String popUpTitle = Utility.messageBD(this, "OBUIAPP_Error", 
vars.getLanguage());
+        String connectErrorMsg = Utility.messageBD(this, "CR_CouldNotConnect", 
vars.getLanguage());
+        advisePopUpRefresh(request, response, "ERROR", popUpTitle, 
connectErrorMsg);
+        return;
+      }
       message = new OBError();
       message.setType("Error");
       message.setTitle(Utility.messageBD(this, message.getType(), 
vars.getLanguage()));

------------------------------------------------------------------------------
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

Reply via email to