From d9a21df34b23efeeae83fe0d2674cbbfc81b2912 Mon Sep 17 00:00:00 2001 From: Harsh J Date: Tue, 15 Jan 2013 13:53:18 +0000 Subject: [PATCH] MAPREDUCE-4925. The pentomino option parser may be buggy. Contributed by Karthik Kambatla. (harsh) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1433414 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../examples/dancing/DistributedPentomino.java | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index b2b9f612f1..cd6a4715b4 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -699,6 +699,9 @@ Release 0.23.6 - UNRELEASED MAPREDUCE-4678. Running the Pentomino example with defaults throws java.lang.NegativeArraySizeException (Chris McConnell via harsh) + MAPREDUCE-4925. The pentomino option parser may be buggy. + (Karthik Kambatla via harsh) + Release 0.23.5 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/dancing/DistributedPentomino.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/dancing/DistributedPentomino.java index 94c647711d..e97d9c3c42 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/dancing/DistributedPentomino.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/dancing/DistributedPentomino.java @@ -174,16 +174,16 @@ public int run(String[] args) throws Exception { return 2; } // check for passed parameters, otherwise use defaults - int width = PENT_WIDTH; - int height = PENT_HEIGHT; - int depth = PENT_DEPTH; + int width = conf.getInt(Pentomino.WIDTH, PENT_WIDTH); + int height = conf.getInt(Pentomino.HEIGHT, PENT_HEIGHT); + int depth = conf.getInt(Pentomino.DEPTH, PENT_DEPTH); for (int i = 0; i < args.length; i++) { if (args[i].equalsIgnoreCase("-depth")) { - depth = Integer.parseInt(args[i++].trim()); + depth = Integer.parseInt(args[++i].trim()); } else if (args[i].equalsIgnoreCase("-height")) { - height = Integer.parseInt(args[i++].trim()); + height = Integer.parseInt(args[++i].trim()); } else if (args[i].equalsIgnoreCase("-width") ) { - width = Integer.parseInt(args[i++].trim()); + width = Integer.parseInt(args[++i].trim()); } } // now set the values within conf for M/R tasks to read, this