JAL-629 Firm up bootstrapArgs. Correct '-colour' in test. Separate --headless and...
[jalview.git] / src / jalview / bin / ArgParser.java
index 3dc7921..be2c07f 100644 (file)
@@ -878,14 +878,14 @@ public class ArgParser
     }
   }
 
-  private static final Collection<String> bootstrapArgs = new ArrayList(
-          Arrays.asList("props", "debug"));
+  private static final Collection<Arg> bootstrapArgs = new ArrayList(
+          Arrays.asList(Arg.PROPS, Arg.DEBUG));
 
-  public static Map<String, String> bootstrapArgs(String[] args)
+  public static Map<Arg, String> bootstrapArgs(String[] args)
   {
-    Map<String, String> argMap = new HashMap<>();
+    Map<Arg, String> bootstrapArgMap = new HashMap<>();
     if (args == null)
-      return argMap;
+      return bootstrapArgMap;
     Enumeration<String> argE = Collections.enumeration(Arrays.asList(args));
     while (argE.hasMoreElements())
     {
@@ -904,10 +904,11 @@ public class ArgParser
         {
           argName = arg.substring(2);
         }
-        if (bootstrapArgs.contains(argName))
-          argMap.put(argName, val);
+        Arg a = argMap.get(argName);
+        if (a != null && bootstrapArgs.contains(a))
+          bootstrapArgMap.put(a, val);
       }
     }
-    return argMap;
+    return bootstrapArgMap;
   }
 }
\ No newline at end of file