Author: toad
Date: 2006-09-28 17:34:18 +0000 (Thu, 28 Sep 2006)
New Revision: 10549
Modified:
trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
Log:
Log an error if a report is made which is impossible, rather than clipping it.
Modified: trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
===================================================================
--- trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
2006-09-28 17:31:57 UTC (rev 10548)
+++ trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
2006-09-28 17:34:18 UTC (rev 10549)
@@ -137,8 +137,14 @@
public void report(double d) {
long now = System.currentTimeMillis();
synchronized(this) {
- if(d < minReport) d = minReport;
- if(d > maxReport) d = maxReport;
+ if(d < minReport) {
+ Logger.error(this, "Impossible: "+d+" on
"+this, new Exception("error"));
+ return;
+ }
+ if(d > maxReport) {
+ Logger.error(this, "Impossible: "+d+" on
"+this, new Exception("error"));
+ return;
+ }
if(Double.isInfinite(d) || Double.isNaN(d)) {
Logger.error(this, "Reported infinity or NaN to
"+this+" : "+d, new Exception("error"));
return;