From: Ben Soares Date: Thu, 27 Feb 2020 16:09:30 +0000 (+0000) Subject: JAL-3543 Conditional reporting of Install4j and Getdown versions if null X-Git-Tag: Develop-2_11_2_0-d20201215~80^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=510131abf452a7389d0d40afa323d0bec8bb9f0d;hp=56f4324f197ac20954ce304d103ff26f1dda58e2;p=jalview.git JAL-3543 Conditional reporting of Install4j and Getdown versions if null --- diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 3b9b98a..35d6aa3 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -1075,6 +1075,24 @@ 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 */ @@ -1092,20 +1110,17 @@ public class Cache sb.append("\n"); sb.append(System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version")); sb.append("\n"); - sb.append("Install4j version: " - + System.getProperty("sys.install4jVersion")); - sb.append("\n"); - sb.append("Install4j template version: " - + System.getProperty("installer_template_version")); - sb.append("\n"); - sb.append( - "Launcher version: " + System.getProperty("launcher_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")) { - sb.append("Getdown appdir: " + System.getProperty("getdownappdir")); - sb.append("\n"); - sb.append("Java home: " + System.getProperty("java.home")); - sb.append("\n"); + appendIfNotNull(sb, "Getdown appdir: ", + System.getProperty("getdownappdir"), "\n", null); + appendIfNotNull(sb, "Java home: ", System.getProperty("java.home"), + "\n", "unknown"); } return sb.toString(); } diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index a5cf48f..3cae900 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -198,17 +198,24 @@ public class Jalview { System.setSecurityManager(null); System.out - .println("Java version: " + System.getProperty("java.version")); + .println("Java version: " + + System.getProperty("java.version")); System.out.println("Java Home: " + System.getProperty("java.home")); System.out.println(System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version")); - System.out.println("Install4j version: " - + System.getProperty("sys.install4jVersion")); - System.out.println("Install4j template version: " - + System.getProperty("installer_template_version")); - System.out.println( - "Launcher version: " + System.getProperty("launcher_version")); + String val = System.getProperty("sys.install4jVersion"); + if (val != null) { + System.out.println("Install4j version: " + val); + } + val = System.getProperty("installer_template_version"); + if (val != null) { + System.out.println("Install4j template version: " + val); + } + val = System.getProperty("launcher_version"); + if (val != null) { + System.out.println("Launcher version: " + val); + } // report Jalview version Cache.loadBuildProperties(true); @@ -414,6 +421,7 @@ public class Jalview BioJsHTMLOutput.updateBioJS(); } + Cache.log.info("CHECKPOINT 1"); // Move any new getdown-launcher-new.jar into place over old // getdown-launcher.jar String appdirString = System.getProperty("getdownappdir"); @@ -438,6 +446,7 @@ public class Jalview DataSourceType protocol = null; FileLoader fileLoader = new FileLoader(!headless); + Cache.log.info("CHECKPOINT 2"); String groovyscript = null; // script to execute after all loading is // completed one way or another // extract groovy argument and execute if necessary