Merge -c 1225471 from trunk to branch-0.23 to fix MAPREDUCE-3521.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1225472 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arun Murthy 2011-12-29 08:24:41 +00:00
parent c0e9c8bf5e
commit 0e4f690197
3 changed files with 22 additions and 1 deletions

View File

@ -321,6 +321,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 @@ public class StreamJob implements Tool {
}
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

@ -33,6 +33,17 @@ import static org.junit.Assert.*;
*/
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;