Updated Branches:
  refs/heads/trunk 79cabc3fa -> d8742aa46

add null check to StreamingHistogram.sum


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

Branch: refs/heads/trunk
Commit: d8742aa46242c128b73d82f397e303f5a79692ac
Parents: 79cabc3
Author: Brandon Williams <brandonwilli...@apache.org>
Authored: Tue Mar 13 15:36:38 2012 -0500
Committer: Brandon Williams <brandonwilli...@apache.org>
Committed: Tue Mar 13 15:36:38 2012 -0500

----------------------------------------------------------------------
 .../apache/cassandra/utils/StreamingHistogram.java |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d8742aa4/src/java/org/apache/cassandra/utils/StreamingHistogram.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/StreamingHistogram.java 
b/src/java/org/apache/cassandra/utils/StreamingHistogram.java
index a95c259..38b9add 100644
--- a/src/java/org/apache/cassandra/utils/StreamingHistogram.java
+++ b/src/java/org/apache/cassandra/utils/StreamingHistogram.java
@@ -147,6 +147,8 @@ public class StreamingHistogram
         else
         {
             Map.Entry<Double, Long> pi = bin.floorEntry(b);
+            if (pi == null)
+                return 0;
             // calculate estimated count mb for point b
             double weight = (b - pi.getKey()) / (pnext.getKey() - pi.getKey());
             double mb = pi.getValue() + (pnext.getValue() - pi.getValue()) * 
weight;

Reply via email to