HADOOP-10094. NPE in GenericOptionsParser#preProcessForWindows(). Contributed by Enis Soztutar.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1541991 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2013-11-14 17:47:44 +00:00
parent fe67e30bc2
commit 95a87caed0
3 changed files with 14 additions and 0 deletions

View File

@ -434,6 +434,9 @@ Release 2.3.0 - UNRELEASED
HADOOP-10093. hadoop-env.cmd sets HADOOP_CLIENT_OPTS with a max heap size HADOOP-10093. hadoop-env.cmd sets HADOOP_CLIENT_OPTS with a max heap size
that is too small. (Shanyu Zhao via cnauroth) that is too small. (Shanyu Zhao via cnauroth)
HADOOP-10094. NPE in GenericOptionsParser#preProcessForWindows().
(Enis Soztutar via cnauroth)
Release 2.2.1 - UNRELEASED Release 2.2.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -431,6 +431,9 @@ public class GenericOptionsParser {
if (!Shell.WINDOWS) { if (!Shell.WINDOWS) {
return args; return args;
} }
if (args == null) {
return null;
}
List<String> newArgs = new ArrayList<String>(args.length); List<String> newArgs = new ArrayList<String>(args.length);
for (int i=0; i < args.length; i++) { for (int i=0; i < args.length; i++) {
String prop = null; String prop = null;

View File

@ -282,4 +282,12 @@ public class TestGenericOptionsParser extends TestCase {
Arrays.toString(remainingArgs) + Arrays.toString(expectedRemainingArgs), Arrays.toString(remainingArgs) + Arrays.toString(expectedRemainingArgs),
expectedRemainingArgs, remainingArgs); 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();
}
} }