Sfoglia il codice sorgente

HADOOP-6213. Remove commons dependency on commons-cli2. Contributed by Amar Kamat.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20@807986 13f79535-47bb-0310-9956-ffa450edef68
Sharad Agarwal 16 anni fa
parent
commit
ad10800dea

+ 3 - 0
CHANGES.txt

@@ -235,6 +235,9 @@ Release 0.20.1 - Unreleased
     mapred.system.dir in the JobTracker. The JobTracker will bail out if it
     mapred.system.dir in the JobTracker. The JobTracker will bail out if it
     encounters such an exception. (Amar Kamat via ddas)
     encounters such an exception. (Amar Kamat via ddas)
 
 
+    HADOOP-6213. Remove commons dependency on commons-cli2. (Amar Kamat via
+    sharad)
+
 Release 0.20.0 - 2009-04-15
 Release 0.20.0 - 2009-04-15
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

BIN
lib/commons-cli-2.0-SNAPSHOT.jar


+ 6 - 5
src/core/org/apache/hadoop/util/GenericOptionsParser.java

@@ -205,8 +205,7 @@ public class GenericOptionsParser {
     .withDescription("specify an application configuration file")
     .withDescription("specify an application configuration file")
     .create("conf");
     .create("conf");
     Option property = OptionBuilder.withArgName("property=value")
     Option property = OptionBuilder.withArgName("property=value")
-    .hasArgs()
-    .withArgPattern("=", 1)
+    .hasArg()
     .withDescription("use value for given property")
     .withDescription("use value for given property")
     .create('D');
     .create('D');
     Option libjars = OptionBuilder.withArgName("paths")
     Option libjars = OptionBuilder.withArgName("paths")
@@ -281,9 +280,11 @@ public class GenericOptionsParser {
     }
     }
     if (line.hasOption('D')) {
     if (line.hasOption('D')) {
       String[] property = line.getOptionValues('D');
       String[] property = line.getOptionValues('D');
-      for(int i=0; i<property.length-1; i=i+2) {
-        if (property[i]!=null)
-          conf.set(property[i], property[i+1]);
+      for(String prop : property) {
+        String[] keyval = prop.split("=");
+        if (keyval.length == 2) {
+          conf.set(keyval[0], keyval[1]);
+        }
       }
       }
     }
     }
     conf.setBoolean("mapred.used.genericoptionsparser", true);
     conf.setBoolean("mapred.used.genericoptionsparser", true);