hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whe...@apache.org
Subject hadoop git commit: HADOOP-11372. Fix new findbugs warnings in mapreduce-examples. Contributed by Li Lu.
Date Tue, 09 Dec 2014 18:49:20 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 deaa172e7 -> 49aacee2c


HADOOP-11372. Fix new findbugs warnings in mapreduce-examples. Contributed by Li Lu.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/49aacee2
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/49aacee2
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/49aacee2

Branch: refs/heads/branch-2
Commit: 49aacee2cb3ac0edaf9c1319323f3a829f002a42
Parents: deaa172
Author: Haohui Mai <wheat9@apache.org>
Authored: Tue Dec 9 10:48:35 2014 -0800
Committer: Haohui Mai <wheat9@apache.org>
Committed: Tue Dec 9 10:49:11 2014 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt             | 3 +++
 .../src/main/java/org/apache/hadoop/examples/pi/Parser.java | 5 ++---
 .../java/org/apache/hadoop/examples/pi/math/Bellard.java    | 9 ++++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/49aacee2/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 9f404f0..48a7fb8 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -176,6 +176,9 @@ Release 2.7.0 - UNRELEASED
     HADOOP-11368. Fix SSLFactory truststore reloader thread leak in
     KMSClientProvider. (Arun Suresh via wang)
 
+    HADOOP-11372. Fix new findbugs warnings in mapreduce-examples.
+    (Li Lu via wheat9)
+
 Release 2.6.0 - 2014-11-18
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/49aacee2/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/Parser.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/Parser.java
b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/Parser.java
index 187520a..a2db9d1 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/Parser.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/Parser.java
@@ -151,11 +151,10 @@ public final class Parser {
   static <T extends Combinable<T>> Map<Parameter, T> combine(Map<Parameter,
List<T>> m) {
     final Map<Parameter, T> combined = new TreeMap<Parameter, T>();
     for(Parameter p : Parameter.values()) {
+      //note: results would never be null due to the design of Util.combine
       final List<T> results = Util.combine(m.get(p));
       Util.out.format("%-6s => ", p); 
-      if (results == null)
-        Util.out.println("null");
-      else if (results.size() != 1) 
+      if (results.size() != 1)
         Util.out.println(results.toString().replace(", ", ",\n           "));
       else {
         final T r = results.get(0);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/49aacee2/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/math/Bellard.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/math/Bellard.java
b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/math/Bellard.java
index 90b608f..d909d92 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/math/Bellard.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/pi/math/Bellard.java
@@ -25,6 +25,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
+import java.util.NoSuchElementException;
 
 import org.apache.hadoop.examples.pi.Container;
 import org.apache.hadoop.examples.pi.Util;
@@ -255,7 +256,13 @@ public final class Bellard {
         public boolean hasNext() {return i < parts.length;}
         /** {@inheritDoc} */
         @Override
-        public Summation next() {return parts[i++];}
+        public Summation next() throws NoSuchElementException {
+          if (hasNext()) {
+            return parts[i++];
+          } else {
+            throw new NoSuchElementException("Sum's iterator does not have next!");
+          }
+        }
         /** Unsupported */
         @Override
         public void remove() {throw new UnsupportedOperationException();}


Mime
View raw message