hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cnaur...@apache.org
Subject svn commit: r1541994 - in /hadoop/common/branches/branch-1-win: CHANGES.branch-1-win.txt src/core/org/apache/hadoop/util/GenericOptionsParser.java src/test/org/apache/hadoop/util/TestGenericOptionsParser.java
Date Thu, 14 Nov 2013 17:49:46 GMT
Author: cnauroth
Date: Thu Nov 14 17:49:46 2013
New Revision: 1541994

URL: http://svn.apache.org/r1541994
Log:
HADOOP-10094. NPE in GenericOptionsParser#preProcessForWindows(). Contributed by Enis Soztutar.

Modified:
    hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
    hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/GenericOptionsParser.java
    hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/util/TestGenericOptionsParser.java

Modified: hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt?rev=1541994&r1=1541993&r2=1541994&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt (original)
+++ hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt Thu Nov 14 17:49:46 2013
@@ -333,6 +333,9 @@ Branch-hadoop-1-win (branched from branc
     HADOOP-9791. Add a test case covering long paths for new FileUtil access
     check methods (ivanmi)
 
+    HADOOP-10094. NPE in GenericOptionsParser#preProcessForWindows().
+    (Enis Soztutar via cnauroth)
+
   Merged from branch-1
 
     HDFS-385. Backport: Add support for an experimental API that allows a

Modified: hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/GenericOptionsParser.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/GenericOptionsParser.java?rev=1541994&r1=1541993&r2=1541994&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/GenericOptionsParser.java
(original)
+++ hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/GenericOptionsParser.java
Thu Nov 14 17:49:46 2013
@@ -413,6 +413,9 @@ public class GenericOptionsParser {
     if (!Shell.WINDOWS) {
       return args;
     }
+    if (args == null) {
+      return null;
+    }
     List<String> newArgs = new ArrayList<String>(args.length);
     for (int i=0; i < args.length; i++) {
       String prop = null;

Modified: hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/util/TestGenericOptionsParser.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/util/TestGenericOptionsParser.java?rev=1541994&r1=1541993&r2=1541994&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/util/TestGenericOptionsParser.java
(original)
+++ hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/util/TestGenericOptionsParser.java
Thu Nov 14 17:49:46 2013
@@ -108,7 +108,7 @@ public class TestGenericOptionsParser ex
     assertNotNull("files is null", files);
     assertEquals("files option does not match",
       localFs.makeQualified(tmpPath).toString(), files);
-    
+
     // pass file as uri
     Configuration conf1 = new Configuration();
     URI tmpURI = new URI(tmpFile.toURI().toString() + "#link");
@@ -117,9 +117,9 @@ public class TestGenericOptionsParser ex
     new GenericOptionsParser(conf1, args);
     files = conf1.get("tmpfiles");
     assertNotNull("files is null", files);
-    assertEquals("files option does not match", 
+    assertEquals("files option does not match",
       localFs.makeQualified(new Path(tmpURI)).toString(), files);
-   
+
     // pass a file that does not exist.
     // GenericOptionParser should throw exception
     Configuration conf2 = new Configuration();
@@ -223,4 +223,12 @@ public class TestGenericOptionsParser ex
       Arrays.toString(remainingArgs) + Arrays.toString(expectedRemainingArgs),
       expectedRemainingArgs, remainingArgs);
   }
+
+  /** Test passing null as args. Some classes still call
+   * Tool interface from java passing null.
+   */
+  public void testNullArgs() throws IOException {
+    GenericOptionsParser parser = new GenericOptionsParser(conf, null);
+    parser.getRemainingArgs();
+  }
 }



Mime
View raw message