HADOOP-6215. fix GenericOptionParser to deal with -D with '=' in the value. Contributed by Amar Kamat.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@808415 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8621b830f8
commit
aa10f303e3
|
@ -944,6 +944,9 @@ Trunk (unreleased changes)
|
|||
HADOOP-6152. Fix classpath variables in bin/hadoop-config.sh and some
|
||||
other scripts. (Aaron Kimball via szetszwo)
|
||||
|
||||
HADOOP-6215. fix GenericOptionParser to deal with -D with '=' in the
|
||||
value. (Amar Kamat via sharad)
|
||||
|
||||
Release 0.20.1 - Unreleased
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -281,7 +281,7 @@ public class GenericOptionsParser {
|
|||
if (line.hasOption('D')) {
|
||||
String[] property = line.getOptionValues('D');
|
||||
for(String prop : property) {
|
||||
String[] keyval = prop.split("=");
|
||||
String[] keyval = prop.split("=", 2);
|
||||
if (keyval.length == 2) {
|
||||
conf.set(keyval[0], keyval[1]);
|
||||
}
|
||||
|
|
|
@ -103,6 +103,12 @@ public class TestGenericsUtil extends TestCase {
|
|||
GenericOptionsParser parser = new GenericOptionsParser(
|
||||
new Configuration(), new String[] {"-jt"});
|
||||
assertEquals(parser.getRemainingArgs().length, 0);
|
||||
|
||||
// test if -D accepts -Dx=y=z
|
||||
parser =
|
||||
new GenericOptionsParser(new Configuration(),
|
||||
new String[] {"-Dx=y=z"});
|
||||
assertEquals(parser.getConfiguration().get("x"), "y=z");
|
||||
}
|
||||
|
||||
public void testGetClass() {
|
||||
|
|
Loading…
Reference in New Issue