Author: toad
Date: 2008-04-11 18:32:06 +0000 (Fri, 11 Apr 2008)
New Revision: 19199
Modified:
trunk/freenet/src/freenet/node/UptimeEstimator.java
Log:
Fix java.lang.ArrayIndexOutOfBoundsException
Modified: trunk/freenet/src/freenet/node/UptimeEstimator.java
===================================================================
--- trunk/freenet/src/freenet/node/UptimeEstimator.java 2008-04-11 18:30:14 UTC
(rev 19198)
+++ trunk/freenet/src/freenet/node/UptimeEstimator.java 2008-04-11 18:32:06 UTC
(rev 19199)
@@ -76,7 +76,9 @@
int offset = dis.readInt();
if(offset < base) continue;
int slotNo = offset - base;
- if(slotNo > wasOnline.length) {
+ if(slotNo == wasOnline.length)
+ break; // Reached the end,
restarted within the same timeslot.
+ if(slotNo > wasOnline.length || slotNo
< 0) {
Logger.error(this, "Corrupt
data read from uptime file "+file+": 5-minutes-from-epoch is now
"+(base+wasOnline.length)+" but read "+slotNo);
break;
}