HADOOP-11509. Change parsing sequence in GenericOptionsParser to parse

-D parameters before -files. Contributed by Xuan Gong
This commit is contained in:
Xuan 2015-01-26 15:35:35 -08:00
parent 1f2b6956c2
commit 0bf333911c
2 changed files with 14 additions and 9 deletions

View File

@ -765,6 +765,9 @@ Release 2.7.0 - UNRELEASED
HADOOP-6221 RPC Client operations cannot be interrupted. (stevel) 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 Release 2.6.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -284,6 +284,17 @@ public class GenericOptionsParser {
conf.addResource(new Path(value)); 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")) { if (line.hasOption("libjars")) {
conf.set("tmpjars", conf.set("tmpjars",
validateFiles(line.getOptionValue("libjars"), conf), validateFiles(line.getOptionValue("libjars"), conf),
@ -307,15 +318,6 @@ public class GenericOptionsParser {
validateFiles(line.getOptionValue("archives"), conf), validateFiles(line.getOptionValue("archives"), conf),
"from -archives command line option"); "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); conf.setBoolean("mapreduce.client.genericoptionsparser.used", true);
// tokensFile // tokensFile