JAL-1551 spotlessApply
[jalview.git] / src / jalview / bin / Cache.java
index 04cf1ec..6b33fea 100755 (executable)
@@ -383,10 +383,13 @@ public class Cache
         {
           // props file provided as URL
           fis = new URL(propertiesFile).openStream();
-          System.out.println(
-                  "Loading jalview properties from : " + propertiesFile);
-          System.out.println(
-                  "Disabling Jalview writing to user's local properties file.");
+          if (!Jalview.quiet())
+          {
+            System.out.println(
+                    "Loading jalview properties from : " + propertiesFile);
+            System.out.println(
+                    "Disabling Jalview writing to user's local properties file.");
+          }
           propsAreReadOnly = true;
         } catch (Exception ex)
         {
@@ -414,7 +417,8 @@ public class Cache
         fis.close();
       } catch (Exception ex)
       {
-        System.out.println("Error reading properties file: " + ex);
+        if (!Jalview.quiet())
+          System.out.println("Error reading properties file: " + ex);
       }
     }
 
@@ -470,7 +474,8 @@ public class Cache
       }
     } catch (Exception ex)
     {
-      System.out.println("Error reading author details: " + ex);
+      if (!Jalview.quiet())
+        System.out.println("Error reading author details: " + ex);
       authorDetails = null;
     }
     if (authorDetails == null)
@@ -533,8 +538,8 @@ public class Cache
           if (orgtimeout == null)
           {
             orgtimeout = "30";
-            System.out.println("# INFO: Setting default net timeout to "
-                    + orgtimeout + " seconds.");
+            Console.debug("Setting default net timeout to " + orgtimeout
+                    + " seconds.");
           }
           String remoteVersion = null;
           if (remoteBuildPropertiesUrl.startsWith("http"))
@@ -554,10 +559,13 @@ public class Cache
               remoteVersion = remoteBuildProperties.getProperty("VERSION");
             } catch (Exception ex)
             {
-              System.out.println(
-                      "Non-fatal exception when checking version at "
-                              + remoteBuildPropertiesUrl + ":");
-              System.out.println(ex);
+              if (!Jalview.quiet())
+              {
+                System.out.println(
+                        "Non-fatal exception when checking version at "
+                                + remoteBuildPropertiesUrl + ":");
+                System.out.println(ex);
+              }
               remoteVersion = getProperty("VERSION");
             }
           }
@@ -656,7 +664,8 @@ public class Cache
       }
     } catch (Exception ex)
     {
-      System.out.println("Error reading build details: " + ex);
+      if (!Jalview.quiet())
+        System.out.println("Error reading build details: " + ex);
       applicationProperties.remove("VERSION");
     }
     String codeVersion = getProperty("VERSION");
@@ -677,7 +686,7 @@ public class Cache
     if (printVersion && reportVersion)
     {
       System.out.println(ChannelProperties.getProperty("app_name")
-              + " Version: " + codeVersion + codeInstallation);
+              + " version: " + codeVersion + codeInstallation);
     }
   }
 
@@ -738,8 +747,9 @@ public class Cache
         def = Integer.parseInt(string);
       } catch (NumberFormatException e)
       {
-        System.out.println("Error parsing int property '" + property
-                + "' with value '" + string + "'");
+        if (!Jalview.quiet())
+          System.out.println("Error parsing int property '" + property
+                  + "' with value '" + string + "'");
       }
     }
 
@@ -780,8 +790,9 @@ public class Cache
       }
     } catch (Exception ex)
     {
-      System.out.println(
-              "Error setting property: " + key + " " + obj + "\n" + ex);
+      if (!Jalview.quiet())
+        System.out.println(
+                "Error setting property: " + key + " " + obj + "\n" + ex);
     }
     return oldValue;
   }
@@ -811,7 +822,8 @@ public class Cache
         out.close();
       } catch (Exception ex)
       {
-        System.out.println("Error saving properties: " + ex);
+        if (!Jalview.quiet())
+          System.out.println("Error saving properties: " + ex);
       }
     }
   }
@@ -1149,7 +1161,8 @@ public class Cache
         }
       } catch (Exception ex)
       {
-        System.out.println("Error loading User ColourFile\n" + ex);
+        if (!Jalview.quiet())
+          System.out.println("Error loading User ColourFile\n" + ex);
       }
     }
     if (!files.equals(coloursFound.toString()))
@@ -1423,11 +1436,10 @@ public class Cache
                 if (customProxySet &&
                 // we have a username but no password for the scheme being
                 // requested
-                        (protocol.equalsIgnoreCase("http")
-                                && (httpUser != null
-                                        && httpUser.length() > 0
-                                        && (httpPassword == null
-                                                || httpPassword.length == 0)))
+                (protocol.equalsIgnoreCase("http")
+                        && (httpUser != null && httpUser.length() > 0
+                                && (httpPassword == null
+                                        || httpPassword.length == 0)))
                         || (protocol.equalsIgnoreCase("https")
                                 && (httpsUser != null
                                         && httpsUser.length() > 0