From a02f07c4bc7174f1470864b696616d34b95d37f8 Mon Sep 17 00:00:00 2001 From: Siddharth Seth Date: Wed, 25 Jan 2012 06:30:09 +0000 Subject: [PATCH] MAPREDUCE-3630. Fixes a NullPointer exception while running TeraGen - if a map is asked to generate 0 records. (Contributed by Mahadev Konar) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1235641 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/examples/terasort/TeraGen.java | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index aedea7f0b3d..0214a638a76 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -555,6 +555,9 @@ Release 0.23.1 - Unreleased MAPREDUCE-3717. JobClient test jar has missing files to run all the test programs. (mahadev) + MAPREDUCE-3630. Fixes a NullPointer exception while running TeraGen - if a + map is asked to generate 0 records. (Mahadev Konar via sseth) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/terasort/TeraGen.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/terasort/TeraGen.java index 9880d54003e..7e679343b4b 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/terasort/TeraGen.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/terasort/TeraGen.java @@ -238,7 +238,9 @@ public class TeraGen extends Configured implements Tool { @Override public void cleanup(Context context) { - checksumCounter.increment(total.getLow8()); + if (checksumCounter != null) { + checksumCounter.increment(total.getLow8()); + } } } @@ -307,5 +309,4 @@ public class TeraGen extends Configured implements Tool { int res = ToolRunner.run(new Configuration(), new TeraGen(), args); System.exit(res); } - }