author | herrick |
Tue, 26 Feb 2019 12:03:51 -0500 | |
branch | JDK-8200758-branch |
changeset 57214 | cb63761b7079 |
child 57391 | 970f28090a06 |
permissions | -rw-r--r-- |
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 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
26 |
package jdk.jpackage.main; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
27 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
28 |
import java.io.IOException; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
29 |
import java.io.Reader; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
30 |
import java.nio.charset.Charset; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
31 |
import java.nio.file.Files; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
32 |
import java.nio.file.Paths; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
33 |
import java.util.ArrayList; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
34 |
import java.util.Arrays; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
35 |
import java.util.List; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
36 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
37 |
/** |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
38 |
* 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
|
39 |
* |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
40 |
* <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
|
41 |
* 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
|
42 |
* 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
|
43 |
* deletion without notice.</b> |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
44 |
*/ |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
45 |
public class CommandLine { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
46 |
/** |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
47 |
* 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
|
48 |
* 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
|
49 |
* 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
|
50 |
* 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
|
51 |
* 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
|
52 |
* '@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
|
53 |
* 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
|
54 |
* the sequence '@@'. |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
55 |
* @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
|
56 |
* @return the arguments, with @files expanded |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
57 |
* @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
|
58 |
*/ |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
59 |
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
|
60 |
List<String> newArgs = new ArrayList<>(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
61 |
appendParsedCommandArgs(newArgs, Arrays.asList(args)); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
62 |
return newArgs.toArray(new String[newArgs.size()]); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
63 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
64 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
65 |
private static void appendParsedCommandArgs(List<String> newArgs, List<String> args) throws IOException { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
66 |
for (String arg : args) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
67 |
if (arg.length() > 1 && arg.charAt(0) == '@') { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
68 |
arg = arg.substring(1); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
69 |
if (arg.charAt(0) == '@') { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
70 |
newArgs.add(arg); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
71 |
} else { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
72 |
loadCmdFile(arg, newArgs); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
73 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
74 |
} else { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
75 |
newArgs.add(arg); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
76 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
77 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
78 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
79 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
80 |
/** |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
81 |
* Process the given environment variable and appends any Win32-style |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
82 |
* command files for the specified command line arguments and return |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
83 |
* the resulting arguments. A command file argument |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
84 |
* 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
|
85 |
* 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
|
86 |
* 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
|
87 |
* '@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
|
88 |
* 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
|
89 |
* the sequence '@@'. |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
90 |
* @param envVariable the env variable to process |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
91 |
* @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
|
92 |
* @return the arguments, with environment variable's content and expansion of @files |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
93 |
* @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
|
94 |
* @throws com.sun.tools.javac.main.CommandLine.UnmatchedQuote |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
95 |
*/ |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
96 |
public static List<String> parse(String envVariable, List<String> args) |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
97 |
throws IOException, UnmatchedQuote { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
98 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
99 |
List<String> inArgs = new ArrayList<>(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
100 |
appendParsedEnvVariables(inArgs, envVariable); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
101 |
inArgs.addAll(args); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
102 |
List<String> newArgs = new ArrayList<>(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
103 |
appendParsedCommandArgs(newArgs, inArgs); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
104 |
return newArgs; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
105 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
106 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
107 |
/** |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
108 |
* Process the given environment variable and appends any Win32-style |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
109 |
* command files for the specified command line arguments and return |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
110 |
* the resulting arguments. A command file argument |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
111 |
* 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
|
112 |
* 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
|
113 |
* 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
|
114 |
* '@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
|
115 |
* 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
|
116 |
* the sequence '@@'. |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
117 |
* @param envVariable the env variable to process |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
118 |
* @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
|
119 |
* @return the arguments, with environment variable's content and expansion of @files |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
120 |
* @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
|
121 |
* @throws com.sun.tools.javac.main.CommandLine.UnmatchedQuote |
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 |
public static String[] parse(String envVariable, String[] args) throws IOException, UnmatchedQuote { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
124 |
List<String> out = parse(envVariable, Arrays.asList(args)); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
125 |
return out.toArray(new String[out.size()]); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
126 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
127 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
128 |
private static void loadCmdFile(String name, List<String> args) throws IOException { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
129 |
try (Reader r = Files.newBufferedReader(Paths.get(name), Charset.defaultCharset())) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
130 |
Tokenizer t = new Tokenizer(r); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
131 |
String s; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
132 |
while ((s = t.nextToken()) != null) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
133 |
args.add(s); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
134 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
135 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
136 |
} |
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 |
public static class Tokenizer { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
139 |
private final Reader in; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
140 |
private int ch; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
141 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
142 |
public Tokenizer(Reader in) throws IOException { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
143 |
this.in = in; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
144 |
ch = in.read(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
145 |
} |
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 |
public String nextToken() throws IOException { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
148 |
skipWhite(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
149 |
if (ch == -1) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
150 |
return null; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
151 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
152 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
153 |
StringBuilder sb = new StringBuilder(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
154 |
char quoteChar = 0; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
155 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
156 |
while (ch != -1) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
157 |
switch (ch) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
158 |
case ' ': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
159 |
case '\t': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
160 |
case '\f': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
161 |
if (quoteChar == 0) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
162 |
return sb.toString(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
163 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
164 |
sb.append((char) ch); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
165 |
break; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
166 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
167 |
case '\n': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
168 |
case '\r': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
169 |
return sb.toString(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
170 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
171 |
case '\'': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
172 |
case '"': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
173 |
if (quoteChar == 0) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
174 |
quoteChar = (char) ch; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
175 |
} else if (quoteChar == ch) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
176 |
quoteChar = 0; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
177 |
} else { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
178 |
sb.append((char) ch); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
179 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
180 |
break; |
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 |
case '\\': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
183 |
if (quoteChar != 0) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
184 |
ch = in.read(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
185 |
switch (ch) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
186 |
case '\n': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
187 |
case '\r': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
188 |
while (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f') { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
189 |
ch = in.read(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
190 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
191 |
continue; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
192 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
193 |
case 'n': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
194 |
ch = '\n'; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
195 |
break; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
196 |
case 'r': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
197 |
ch = '\r'; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
198 |
break; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
199 |
case 't': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
200 |
ch = '\t'; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
201 |
break; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
202 |
case 'f': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
203 |
ch = '\f'; |
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 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
207 |
sb.append((char) ch); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
208 |
break; |
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 |
default: |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
211 |
sb.append((char) ch); |
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 |
ch = in.read(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
215 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
216 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
217 |
return sb.toString(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
218 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
219 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
220 |
void skipWhite() throws IOException { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
221 |
while (ch != -1) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
222 |
switch (ch) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
223 |
case ' ': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
224 |
case '\t': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
225 |
case '\n': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
226 |
case '\r': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
227 |
case '\f': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
228 |
break; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
229 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
230 |
case '#': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
231 |
ch = in.read(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
232 |
while (ch != '\n' && ch != '\r' && ch != -1) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
233 |
ch = in.read(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
234 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
235 |
break; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
236 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
237 |
default: |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
238 |
return; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
239 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
240 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
241 |
ch = in.read(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
242 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
243 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
244 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
245 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
246 |
@SuppressWarnings("fallthrough") |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
247 |
private static void appendParsedEnvVariables(List<String> newArgs, String envVariable) |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
248 |
throws UnmatchedQuote { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
249 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
250 |
if (envVariable == null) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
251 |
return; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
252 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
253 |
String in = System.getenv(envVariable); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
254 |
if (in == null || in.trim().isEmpty()) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
255 |
return; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
256 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
257 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
258 |
final char NUL = (char)0; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
259 |
final int len = in.length(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
260 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
261 |
int pos = 0; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
262 |
StringBuilder sb = new StringBuilder(); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
263 |
char quote = NUL; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
264 |
char ch; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
265 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
266 |
loop: |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
267 |
while (pos < len) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
268 |
ch = in.charAt(pos); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
269 |
switch (ch) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
270 |
case '\"': case '\'': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
271 |
if (quote == NUL) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
272 |
quote = ch; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
273 |
} else if (quote == ch) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
274 |
quote = NUL; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
275 |
} else { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
276 |
sb.append(ch); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
277 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
278 |
pos++; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
279 |
break; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
280 |
case '\f': case '\n': case '\r': case '\t': case ' ': |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
281 |
if (quote == NUL) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
282 |
newArgs.add(sb.toString()); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
283 |
sb.setLength(0); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
284 |
while (ch == '\f' || ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
285 |
pos++; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
286 |
if (pos >= len) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
287 |
break loop; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
288 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
289 |
ch = in.charAt(pos); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
290 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
291 |
break; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
292 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
293 |
// fall through |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
294 |
default: |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
295 |
sb.append(ch); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
296 |
pos++; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
297 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
298 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
299 |
if (sb.length() != 0) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
300 |
newArgs.add(sb.toString()); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
301 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
302 |
if (quote != NUL) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
303 |
throw new UnmatchedQuote(envVariable); |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
304 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
305 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
306 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
307 |
public static class UnmatchedQuote extends Exception { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
308 |
private static final long serialVersionUID = 0; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
309 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
310 |
public final String variableName; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
311 |
|
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
312 |
UnmatchedQuote(String variable) { |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
313 |
this.variableName = variable; |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
314 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
315 |
} |
cb63761b7079
8219695: Use a copy of javac's implementation of @argfile in jpackager
herrick
parents:
diff
changeset
|
316 |
} |