src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/main/CommandLine.java
author herrick
Fri, 08 Nov 2019 14:53:03 -0500
branchJDK-8200758-branch
changeset 58994 b09ba68c6a19
parent 57909 src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java@c7de06ed4b54
permissions -rw-r--r--
8233636 : Make jpackage an incubator and remove tool provider implementation Reviewed-by: asemenyuk, almatvee, kcr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
     1
/*
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
     2
 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
     4
 *
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    10
 *
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    15
 * accompanied this code).
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    16
 *
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    20
 *
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    23
 * questions.
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    24
 */
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    25
58994
b09ba68c6a19 8233636 : Make jpackage an incubator and remove tool provider implementation
herrick
parents: 57909
diff changeset
    26
package jdk.incubator.jpackage.main;
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    27
57447
3fbe47a62ed0 8226751: "Exception: ..." for missing file
herrick
parents: 57438
diff changeset
    28
import java.io.FileNotFoundException;
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    29
import java.io.IOException;
57447
3fbe47a62ed0 8226751: "Exception: ..." for missing file
herrick
parents: 57438
diff changeset
    30
import java.io.File;
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    31
import java.io.Reader;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    32
import java.nio.charset.Charset;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    33
import java.nio.file.Files;
57447
3fbe47a62ed0 8226751: "Exception: ..." for missing file
herrick
parents: 57438
diff changeset
    34
import java.nio.file.Path;
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    35
import java.nio.file.Paths;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    36
import java.util.ArrayList;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    37
import java.util.Arrays;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    38
import java.util.List;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    39
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    40
/**
57447
3fbe47a62ed0 8226751: "Exception: ..." for missing file
herrick
parents: 57438
diff changeset
    41
 * This file was originally a copy of CommandLine.java in
3fbe47a62ed0 8226751: "Exception: ..." for missing file
herrick
parents: 57438
diff changeset
    42
 * com.sun.tools.javac.main.
57391
970f28090a06 8223334: Additional cleanup in jpackage tool
herrick
parents: 57214
diff changeset
    43
 * It should track changes made to that file.
970f28090a06 8223334: Additional cleanup in jpackage tool
herrick
parents: 57214
diff changeset
    44
 */
970f28090a06 8223334: Additional cleanup in jpackage tool
herrick
parents: 57214
diff changeset
    45
970f28090a06 8223334: Additional cleanup in jpackage tool
herrick
parents: 57214
diff changeset
    46
/**
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    47
 * Various utility methods for processing Java tool command line arguments.
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    48
 *
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    49
 *  <p><b>This is NOT part of any supported API.
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    50
 *  If you write code that depends on this, you do so at your own risk.
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    51
 *  This code and its internal interfaces are subject to change or
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    52
 *  deletion without notice.</b>
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    53
 */
57404
a477b26bf888 8223643: Provide better defined context for custom installer steps on Windows
herrick
parents: 57391
diff changeset
    54
class CommandLine {
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    55
    /**
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    56
     * Process Win32-style command files for the specified command line
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    57
     * arguments and return the resulting arguments. A command file argument
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    58
     * is of the form '@file' where 'file' is the name of the file whose
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    59
     * contents are to be parsed for additional arguments. The contents of
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    60
     * the command file are parsed using StreamTokenizer and the original
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    61
     * '@file' argument replaced with the resulting tokens. Recursive command
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    62
     * files are not supported. The '@' character itself can be quoted with
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    63
     * the sequence '@@'.
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    64
     * @param args the arguments that may contain @files
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    65
     * @return the arguments, with @files expanded
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    66
     * @throws IOException if there is a problem reading any of the @files
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    67
     */
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    68
    public static String[] parse(String[] args) throws IOException {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    69
        List<String> newArgs = new ArrayList<>();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    70
        appendParsedCommandArgs(newArgs, Arrays.asList(args));
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    71
        return newArgs.toArray(new String[newArgs.size()]);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    72
    }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    73
57909
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57447
diff changeset
    74
    private static void appendParsedCommandArgs(List<String> newArgs,
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57447
diff changeset
    75
            List<String> args) throws IOException {
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    76
        for (String arg : args) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    77
            if (arg.length() > 1 && arg.charAt(0) == '@') {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    78
                arg = arg.substring(1);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    79
                if (arg.charAt(0) == '@') {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    80
                    newArgs.add(arg);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    81
                } else {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    82
                    loadCmdFile(arg, newArgs);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    83
                }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    84
            } else {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    85
                newArgs.add(arg);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    86
            }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    87
        }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    88
    }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    89
57909
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57447
diff changeset
    90
    private static void loadCmdFile(String name, List<String> args)
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57447
diff changeset
    91
            throws IOException {
57447
3fbe47a62ed0 8226751: "Exception: ..." for missing file
herrick
parents: 57438
diff changeset
    92
        if (!Files.isReadable(Path.of(name))) {
3fbe47a62ed0 8226751: "Exception: ..." for missing file
herrick
parents: 57438
diff changeset
    93
            throw new FileNotFoundException(name);
3fbe47a62ed0 8226751: "Exception: ..." for missing file
herrick
parents: 57438
diff changeset
    94
        }
57909
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57447
diff changeset
    95
        try (Reader r = Files.newBufferedReader(Paths.get(name),
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57447
diff changeset
    96
                Charset.defaultCharset())) {
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    97
            Tokenizer t = new Tokenizer(r);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    98
            String s;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
    99
            while ((s = t.nextToken()) != null) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   100
                args.add(s);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   101
            }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   102
        }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   103
    }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   104
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   105
    public static class Tokenizer {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   106
        private final Reader in;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   107
        private int ch;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   108
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   109
        public Tokenizer(Reader in) throws IOException {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   110
            this.in = in;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   111
            ch = in.read();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   112
        }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   113
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   114
        public String nextToken() throws IOException {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   115
            skipWhite();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   116
            if (ch == -1) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   117
                return null;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   118
            }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   119
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   120
            StringBuilder sb = new StringBuilder();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   121
            char quoteChar = 0;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   122
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   123
            while (ch != -1) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   124
                switch (ch) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   125
                    case ' ':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   126
                    case '\t':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   127
                    case '\f':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   128
                        if (quoteChar == 0) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   129
                            return sb.toString();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   130
                        }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   131
                        sb.append((char) ch);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   132
                        break;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   133
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   134
                    case '\n':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   135
                    case '\r':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   136
                        return sb.toString();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   137
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   138
                    case '\'':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   139
                    case '"':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   140
                        if (quoteChar == 0) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   141
                            quoteChar = (char) ch;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   142
                        } else if (quoteChar == ch) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   143
                            quoteChar = 0;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   144
                        } else {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   145
                            sb.append((char) ch);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   146
                        }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   147
                        break;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   148
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   149
                    case '\\':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   150
                        if (quoteChar != 0) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   151
                            ch = in.read();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   152
                            switch (ch) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   153
                                case '\n':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   154
                                case '\r':
57909
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57447
diff changeset
   155
                                    while (ch == ' ' || ch == '\n'
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57447
diff changeset
   156
                                            || ch == '\r' || ch == '\t'
c7de06ed4b54 8229979: jpackage cleanup src files, help text, and javadoc
herrick
parents: 57447
diff changeset
   157
                                            || ch == '\f') {
57214
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   158
                                        ch = in.read();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   159
                                    }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   160
                                    continue;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   161
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   162
                                case 'n':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   163
                                    ch = '\n';
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   164
                                    break;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   165
                                case 'r':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   166
                                    ch = '\r';
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   167
                                    break;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   168
                                case 't':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   169
                                    ch = '\t';
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   170
                                    break;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   171
                                case 'f':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   172
                                    ch = '\f';
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   173
                                    break;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   174
                            }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   175
                        }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   176
                        sb.append((char) ch);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   177
                        break;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   178
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   179
                    default:
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   180
                        sb.append((char) ch);
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   181
                }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   182
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   183
                ch = in.read();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   184
            }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   185
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   186
            return sb.toString();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   187
        }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   188
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   189
        void skipWhite() throws IOException {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   190
            while (ch != -1) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   191
                switch (ch) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   192
                    case ' ':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   193
                    case '\t':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   194
                    case '\n':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   195
                    case '\r':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   196
                    case '\f':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   197
                        break;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   198
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   199
                    case '#':
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   200
                        ch = in.read();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   201
                        while (ch != '\n' && ch != '\r' && ch != -1) {
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   202
                            ch = in.read();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   203
                        }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   204
                        break;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   205
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   206
                    default:
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   207
                        return;
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   208
                }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   209
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   210
                ch = in.read();
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   211
            }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   212
        }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   213
    }
cb63761b7079 8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff changeset
   214
}