diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 2051698f3f..4b23471bce 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -542,6 +542,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 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 187520a399..a2db9d1bac 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 @@ Map> parse(String inputpath, String outputdir static > Map combine(Map> m) { final Map combined = new TreeMap(); for(Parameter p : Parameter.values()) { + //note: results would never be null due to the design of Util.combine final List 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); 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 90b608fd24..d909d92945 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.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 Iterator iterator() { 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();}