JAL-4121 slight refactoring of method name and added tests for headless assumptions...
[jalview.git] / src / jalview / bin / Jalview.java
index 7535f60..dc97549 100755 (executable)
@@ -396,7 +396,7 @@ public class Jalview
 
     // get bootstrap properties (mainly for the logger level)
     Properties bootstrapProperties = Cache
-            .bootstrapProperties(bootstrapArgs.get(Arg.PROPS));
+            .bootstrapProperties(bootstrapArgs.getValue(Arg.PROPS));
 
     // report Jalview version
     Cache.loadBuildProperties(
@@ -482,7 +482,7 @@ public class Jalview
     });
 
     String usrPropsFile = bootstrapArgs.contains(Arg.PROPS)
-            ? bootstrapArgs.get(Arg.PROPS)
+            ? bootstrapArgs.getValue(Arg.PROPS)
             : aparser.getValue("props");
     // if usrPropsFile == null, loadProperties will use the Channel
     // preferences.file
@@ -536,7 +536,7 @@ public class Jalview
       }
 
       // new CLI
-      headlessArg = isHeadless(bootstrapArgs);
+      headlessArg = bootstrapArgs.isHeadless();
       if (headlessArg)
       {
         System.setProperty("java.awt.headless", "true");
@@ -553,7 +553,7 @@ public class Jalview
       // allow https handshakes to download intermediate certs if necessary
       System.setProperty("com.sun.security.enableAIAcaIssuers", "true");
 
-      String jabawsUrl = bootstrapArgs.get(Arg.JABAWS);
+      String jabawsUrl = bootstrapArgs.getValue(Arg.JABAWS);
       if (jabawsUrl == null)
         jabawsUrl = aparser.getValue("jabaws");
       if (jabawsUrl != null)
@@ -645,7 +645,7 @@ public class Jalview
 
     if (!(headless || headlessArg))
     {
-      Desktop.nosplash = "false".equals(bootstrapArgs.get(Arg.SPLASH))
+      Desktop.nosplash = "false".equals(bootstrapArgs.getValue(Arg.SPLASH))
               || aparser.contains("nosplash")
               || Cache.getDefault("SPLASH", "true").equals("false");
       desktop = new Desktop();
@@ -774,8 +774,8 @@ public class Jalview
 
         if ((!aparser.contains("nonews")
                 && Cache.getProperty("NONEWS") == null
-                && !"false".equals(bootstrapArgs.get(Arg.NEWS)))
-                || "true".equals(bootstrapArgs.get(Arg.NEWS)))
+                && !"false".equals(bootstrapArgs.getValue(Arg.NEWS)))
+                || "true".equals(bootstrapArgs.getValue(Arg.NEWS)))
         {
           desktop.checkForNews();
         }
@@ -1886,26 +1886,4 @@ public class Jalview
     System.out.println("[TESTOUTPUT] arg "
             + (yes ? a.argString() : a.negateArgString()) + " was set");
   }
-
-  private static boolean isHeadless(BootstrapArgs bootstrapArgs)
-  {
-    if (bootstrapArgs == null)
-    {
-      return false;
-    }
-    boolean isHeadless = false;
-    if (bootstrapArgs.contains(Arg.GUI))
-    {
-      isHeadless = !bootstrapArgs.getBoolean(Arg.GUI);
-    }
-    else if (bootstrapArgs.contains(Arg.HEADLESS))
-    {
-      isHeadless = bootstrapArgs.getBoolean(Arg.HEADLESS);
-    }
-    else if (bootstrapArgs.argsHaveOption(Opt.OUTPUTFILE))
-    {
-      isHeadless = true;
-    }
-    return isHeadless;
-  }
 }