MAPREDUCE-3521. Fixed streaming to ensure it doesn't silently ignore unknown arguments. Contributed by Robert Evans.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1225471 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arun Murthy 2011-12-29 08:24:09 +00:00
parent f025652fda
commit 7afb9aca70
3 changed files with 22 additions and 1 deletions

View File

@ -375,6 +375,9 @@ Release 0.23.1 - Unreleased
MAPREDUCE-3604. Fixed streaming to use new mapreduce.framework.name to
check for local mode. (acmurthy)
MAPREDUCE-3521. Fixed streaming to ensure it doesn't silently ignore
unknown arguments. (Robert Evans via acmurthy)
Release 0.23.0 - 2011-11-01
INCOMPATIBLE CHANGES

View File

@ -255,6 +255,13 @@ void parseArgv() {
}
if (cmdLine != null) {
@SuppressWarnings("unchecked")
List<String> args = cmdLine.getArgList();
if(args != null && args.size() > 0) {
fail("Found " + args.size() + " unexpected arguments on the " +
"command line " + args);
}
detailedUsage_ = cmdLine.hasOption("info");
if (cmdLine.hasOption("help") || detailedUsage_) {
printUsage = true;

View File

@ -32,7 +32,18 @@
* This class tests hadoop Streaming's StreamJob class.
*/
public class TestStreamJob {
@Test(expected = IllegalArgumentException.class)
public void testCreateJobWithExtraArgs() throws IOException {
ArrayList<String> dummyArgs = new ArrayList<String>();
dummyArgs.add("-input"); dummyArgs.add("dummy");
dummyArgs.add("-output"); dummyArgs.add("dummy");
dummyArgs.add("-mapper"); dummyArgs.add("dummy");
dummyArgs.add("dummy");
dummyArgs.add("-reducer"); dummyArgs.add("dummy");
StreamJob.createJob(dummyArgs.toArray(new String[] {}));
}
@Test
public void testCreateJob() throws IOException {
JobConf job;