details:   /erp/devel/pi/rev/23715aab3356
changeset: 10450:23715aab3356
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Wed Feb 09 10:35:54 2011 +0100
summary:   Caches value for isInternetAvailable to avoid same request on each 
login

details:   /erp/devel/pi/rev/2ee84c2955e0
changeset: 10451:2ee84c2955e0
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Wed Feb 09 10:37:55 2011 +0100
summary:   Rollback unwanted changes in chageset b3b8995c898a

diffstat:

 
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector.ftl
 |   2 +-
 src-db/database/sourcedata/AD_REFERENCE.xml                                    
                              |   1 -
 src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml                            
                              |  13 ----------
 src/org/openbravo/erpCommon/utility/HttpsUtils.java                            
                              |  11 ++++++--
 4 files changed, 9 insertions(+), 18 deletions(-)

diffs (80 lines):

diff -r 6283fd69040a -r 2ee84c2955e0 
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector.ftl
--- 
a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector.ftl
      Wed Feb 09 09:51:40 2011 +0100
+++ 
b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector.ftl
      Wed Feb 09 10:37:55 2011 +0100
@@ -43,7 +43,7 @@
     ],
     outFields : {
     <#list data.outFields as selectorOutField>
-    '${selectorOutField.outFieldName}': 
{'fieldName':'${selectorOutField.tabFieldName}', 'suffix': 
'${selectorOutField.outSuffix}'}<#if selectorOutField_has_next>,</#if>
+    '${selectorOutField.outFieldName}':'${selectorOutField.tabFieldName}'<#if 
selectorOutField_has_next>,</#if>
     </#list>
     },
     extraSearchFields: [${data.extraSearchFields}],
diff -r 6283fd69040a -r 2ee84c2955e0 src-db/database/sourcedata/AD_REFERENCE.xml
--- a/src-db/database/sourcedata/AD_REFERENCE.xml       Wed Feb 09 09:51:40 
2011 +0100
+++ b/src-db/database/sourcedata/AD_REFERENCE.xml       Wed Feb 09 10:37:55 
2011 +0100
@@ -3540,7 +3540,6 @@
 <!--800057-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--800057-->  <ISBASEREFERENCE><![CDATA[N]]></ISBASEREFERENCE>
 <!--800057-->  <PARENTREFERENCE_ID><![CDATA[30]]></PARENTREFERENCE_ID>
-<!--800057-->  
<UI_IMPL><![CDATA[org.openbravo.userinterface.selector.reference.SelectorUIReference]]></UI_IMPL>
 <!--800057-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--800057--></AD_REFERENCE>
 
diff -r 6283fd69040a -r 2ee84c2955e0 
src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml
--- a/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml       Wed Feb 09 
09:51:40 2011 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<data>
-<!--FF8080812E04B22A012E04B79C20001B--><OBCLKER_UIDEFINITION>
-<!--FF8080812E04B22A012E04B79C20001B-->  
<OBCLKER_UIDEFINITION_ID><![CDATA[FF8080812E04B22A012E04B79C20001B]]></OBCLKER_UIDEFINITION_ID>
-<!--FF8080812E04B22A012E04B79C20001B-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--FF8080812E04B22A012E04B79C20001B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--FF8080812E04B22A012E04B79C20001B-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--FF8080812E04B22A012E04B79C20001B-->  
<AD_REFERENCE_ID><![CDATA[800057]]></AD_REFERENCE_ID>
-<!--FF8080812E04B22A012E04B79C20001B-->  
<CLASSNAME><![CDATA[org.openbravo.userinterface.selector.reference.FKSelectorUIDefinition]]></CLASSNAME>
-<!--FF8080812E04B22A012E04B79C20001B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--FF8080812E04B22A012E04B79C20001B--></OBCLKER_UIDEFINITION>
-
-</data>
diff -r 6283fd69040a -r 2ee84c2955e0 
src/org/openbravo/erpCommon/utility/HttpsUtils.java
--- a/src/org/openbravo/erpCommon/utility/HttpsUtils.java       Wed Feb 09 
09:51:40 2011 +0100
+++ b/src/org/openbravo/erpCommon/utility/HttpsUtils.java       Wed Feb 09 
10:37:55 2011 +0100
@@ -44,6 +44,7 @@
 public class HttpsUtils {
 
   private static Logger log4j = Logger.getLogger(HttpsUtils.class);
+  private static Boolean isInternetAvailable = null;
 
   static String sendSecure(HttpsURLConnection conn, String data) throws 
IOException {
     String result = null;
@@ -155,6 +156,9 @@
    * @return true in case Internet (https://butler.openbravo.com) is reachable.
    */
   public static boolean isInternetAvailable() {
+    if (isInternetAvailable != null) {
+      return isInternetAvailable;
+    }
     return isInternetAvailable(null, 0);
   }
 
@@ -234,13 +238,14 @@
       conn.setConnectTimeout(3000);
       conn.connect();
       if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
-        return false;
+        isInternetAvailable = Boolean.FALSE;
       }
     } catch (Exception e) {
       log4j.info("Unable to reach butler.openbravo.com");
-      return false;
+      isInternetAvailable = Boolean.FALSE;
     }
-    return true;
+    isInternetAvailable = Boolean.TRUE;
+    return isInternetAvailable;
   }
 
 }
\ No newline at end of file

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to