Update of /cvsroot/freenet/freenet/src/freenet/node/rt
In directory sc8-pr-cvs1:/tmp/cvs-serv22083/src/freenet/node/rt
Modified Files:
DecayingRunningAverage.java
Log Message:
6507: Sanity checking on serialized in DecayingRunningAverage's
Index: DecayingRunningAverage.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/DecayingRunningAverage.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -r1.8 -r1.9
--- DecayingRunningAverage.java 1 Nov 2003 15:13:35 -0000 1.8
+++ DecayingRunningAverage.java 4 Nov 2003 18:31:36 -0000 1.9
@@ -11,6 +11,8 @@
double currentVal;
final double decayFactor;
public DecayingRunningAverage(double startVal, double decayFactor) {
+ if(Double.isInfinite(startVal) || Double.isNaN(startVal))
+ throw new IllegalArgumentException("Infinite or NaN startVal:
"+startVal);
this.decayFactor = decayFactor;
this.currentVal = startVal;
}
@@ -19,6 +21,9 @@
throws IOException {
this.decayFactor = decayFactor;
this.currentVal = dis.readDouble();
+ if(Double.isInfinite(currentVal) || Double.isNaN(currentVal)) {
+ throw new IOException("Invalid value serializing in: "+currentVal);
+ }
// hack to correct data - to be removed. edt
if(currentVal<0 || currentVal>(3600*1000)) {
Core.logger.log(this, "reset "+currentVal,
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs