src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java
branchJDK-8200758-branch
changeset 57447 3fbe47a62ed0
parent 57438 4a31db8d42bd
child 57909 c7de06ed4b54
equal deleted inserted replaced
57446:5a5b85f00a63 57447:3fbe47a62ed0
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package jdk.jpackage.main;
    26 package jdk.jpackage.main;
    27 
    27 
       
    28 import java.io.FileNotFoundException;
    28 import java.io.IOException;
    29 import java.io.IOException;
       
    30 import java.io.File;
    29 import java.io.Reader;
    31 import java.io.Reader;
    30 import java.nio.charset.Charset;
    32 import java.nio.charset.Charset;
    31 import java.nio.file.Files;
    33 import java.nio.file.Files;
       
    34 import java.nio.file.Path;
    32 import java.nio.file.Paths;
    35 import java.nio.file.Paths;
    33 import java.util.ArrayList;
    36 import java.util.ArrayList;
    34 import java.util.Arrays;
    37 import java.util.Arrays;
    35 import java.util.List;
    38 import java.util.List;
    36 
    39 
    37 /**
    40 /**
    38  * This file is direct copy of CommandLine.java in com.sun.tools.javac.main.
    41  * This file was originally a copy of CommandLine.java in
       
    42  * com.sun.tools.javac.main.
    39  * It should track changes made to that file.
    43  * It should track changes made to that file.
    40  * It is modified only to remove content not used by jpackage
       
    41  */
    44  */
    42 
    45 
    43 /**
    46 /**
    44  * Various utility methods for processing Java tool command line arguments.
    47  * Various utility methods for processing Java tool command line arguments.
    45  *
    48  *
    82             }
    85             }
    83         }
    86         }
    84     }
    87     }
    85 
    88 
    86     private static void loadCmdFile(String name, List<String> args) throws IOException {
    89     private static void loadCmdFile(String name, List<String> args) throws IOException {
       
    90         if (!Files.isReadable(Path.of(name))) {
       
    91             throw new FileNotFoundException(name);
       
    92         }
    87         try (Reader r = Files.newBufferedReader(Paths.get(name), Charset.defaultCharset())) {
    93         try (Reader r = Files.newBufferedReader(Paths.get(name), Charset.defaultCharset())) {
    88             Tokenizer t = new Tokenizer(r);
    94             Tokenizer t = new Tokenizer(r);
    89             String s;
    95             String s;
    90             while ((s = t.nextToken()) != null) {
    96             while ((s = t.nextToken()) != null) {
    91                 args.add(s);
    97                 args.add(s);