Merge branch 'develop' into Jalview-JS/develop
[jalview.git] / src / jalview / bin / Cache.java
index 94a1825..788cb02 100755 (executable)
@@ -1114,31 +1114,54 @@ public class Cache
   }
 
   /**
+   * Initial logging information helper for various versions output
+   * 
+   * @param prefix
+   * @param value
+   * @param defaultValue
+   */
+  private static void appendIfNotNull(StringBuilder sb, String prefix,
+          String value, String suffix, String defaultValue)
+  {
+    if (value == null && defaultValue == null)
+    {
+      return;
+    }
+    String line = prefix + (value != null ? value : defaultValue) + suffix;
+    sb.append(line);
+  }
+
+  /**
    * 
    * @return Jalview version, build details and JVM platform version for console
    */
   public static String getVersionDetailsForConsole()
   {
-    return "Jalview Version: "
-            + jalview.bin.Cache.getDefault("VERSION", "TEST")
-            + "\n" + "Jalview Installation: "
-            + jalview.bin.Cache.getDefault("INSTALLATION",
-                    "unknown")
-            + "\n" + "Build Date: "
-            + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")
-            + "\n" + "Java version: "
-            + System.getProperty("java.version") + "\n"
-            + System.getProperty("os.arch") + " "
-            + System.getProperty("os.name") + " "
-            + System.getProperty("os.version")
-            + (jalview.bin.Cache.getDefault("VERSION", "TEST")
-                    .equals("DEVELOPMENT")
-                                                               ? "\nGetdown appdir: " + System.getProperty("getdownappdir") + "\nJava path: "
-                                    + System.getProperty(
-                                            "java.home")
-                                    + File.separator + "bin"
-                                    + File.separator + "java"
-                                                               : "");
+    StringBuilder sb = new StringBuilder();
+    sb.append("Jalview Version: " + jalview.bin.Cache.getDefault("VERSION", "TEST"));
+    sb.append("\n");
+    sb.append("Jalview Installation: "
+            + jalview.bin.Cache.getDefault("INSTALLATION", "unknown"));
+    sb.append("\n");
+    sb.append("Build Date: " + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"));
+    sb.append("\n");
+    sb.append("Java version: " + System.getProperty("java.version"));
+    sb.append("\n");
+    sb.append(System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version"));
+    sb.append("\n");
+    appendIfNotNull(sb, "Install4j version: ",
+            System.getProperty("sys.install4jVersion"), "\n", null);
+    appendIfNotNull(sb, "Install4j template version: ",
+            System.getProperty("installer_template_version"), "\n", null);
+    appendIfNotNull(sb, "Launcher version: ",
+            System.getProperty("launcher_version"), "\n", null);
+    if (jalview.bin.Cache.getDefault("VERSION", "TEST").equals("DEVELOPMENT")) {
+      appendIfNotNull(sb, "Getdown appdir: ",
+              System.getProperty("getdownappdir"), "\n", null);
+      appendIfNotNull(sb, "Java home: ", System.getProperty("java.home"),
+              "\n", "unknown");
+    }
+    return sb.toString();
   }
 
   /**