prevent exception when no default timeout is specified
[jalview.git] / src / jalview / bin / Cache.java
index 92bd7b6..0744cd9 100755 (executable)
@@ -53,6 +53,7 @@ import org.apache.log4j.*;
  * </li><li>SHOW_QUALITY show alignment quality annotation
  * </li><li>SHOW_ANNOTATIONS show alignment annotation rows
  * </li><li>SHOW_CONSERVATION show alignment conservation annotation
+ * </li><li>CENTRE_COLUMN_LABELS centre the labels at each column in a displayed annotation row 
  * </li><li>DEFAULT_COLOUR default colour scheme to apply for a new alignment
  * </li><li>DEFAULT_FILE_FORMAT file format used to save 
  * </li><li>STARTUP_FILE file loaded on startup (may be a fully qualified url)
@@ -237,9 +238,16 @@ public class Cache
       {
         public void run()
         {
+          String orgtimeout = System.getProperty("sun.net.client.defaultConnectTimeout");
+          if (orgtimeout==null)
+          {
+            orgtimeout="30";
+            System.out.println("# INFO: Setting default net timeout to "+orgtimeout+" seconds.");
+          }
           String jnlpVersion = null;
           try
           {
+            System.setProperty("sun.net.client.defaultConnectTimeout", "5000");
             java.net.URL url = new java.net.URL(
                 "http://www.jalview.org/webstart/jalview.jnlp");
             BufferedReader in = new BufferedReader(new InputStreamReader(url.
@@ -260,9 +268,11 @@ public class Cache
           }
           catch (Exception ex)
           {
+            System.out.println("Non-fatal exceptions when checking version at www.jalview.org :");
             System.out.println(ex);
             jnlpVersion = getProperty("VERSION");
           }
+          System.setProperty("sun.net.client.defaultConnectTimeout", orgtimeout);
 
           setProperty("LATEST_VERSION", jnlpVersion);
         }