HADOOP-11509. Change parsing sequence in GenericOptionsParser to parse

-D parameters before -files. Contributed by Xuan Gong

(cherry picked from commit 0bf333911c)
This commit is contained in:
Xuan 2015-01-26 15:35:35 -08:00
parent 0ada35c912
commit f93fa39384
2 changed files with 14 additions and 9 deletions

View File

@ -409,6 +409,9 @@ Release 2.7.0 - UNRELEASED
HADOOP-6221 RPC Client operations cannot be interrupted. (stevel)
HADOOP-11509. Change parsing sequence in GenericOptionsParser to parse -D
parameters before -files. (xgong)
Release 2.6.1 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -284,6 +284,17 @@ public class GenericOptionsParser {
conf.addResource(new Path(value));
}
}
if (line.hasOption('D')) {
String[] property = line.getOptionValues('D');
for(String prop : property) {
String[] keyval = prop.split("=", 2);
if (keyval.length == 2) {
conf.set(keyval[0], keyval[1], "from command line");
}
}
}
if (line.hasOption("libjars")) {
conf.set("tmpjars",
validateFiles(line.getOptionValue("libjars"), conf),
@ -307,15 +318,6 @@ public class GenericOptionsParser {
validateFiles(line.getOptionValue("archives"), conf),
"from -archives command line option");
}
if (line.hasOption('D')) {
String[] property = line.getOptionValues('D');
for(String prop : property) {
String[] keyval = prop.split("=", 2);
if (keyval.length == 2) {
conf.set(keyval[0], keyval[1], "from command line");
}
}
}
conf.setBoolean("mapreduce.client.genericoptionsparser.used", true);
// tokensFile