Author: nextgens
Date: 2006-12-09 17:07:01 +0000 (Sat, 09 Dec 2006)
New Revision: 11317

Modified:
   trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java
Log:
Fix a NPE in IOStatisticCollector ... btw, why aren't we using a mutex and 
iterating there ?

Modified: trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java 2006-12-09 
16:55:13 UTC (rev 11316)
+++ trunk/freenet/src/freenet/io/comm/IOStatisticCollector.java 2006-12-09 
17:07:01 UTC (rev 11317)
@@ -150,13 +150,14 @@
        private void rotate() {
                long now = System.currentTimeMillis();
                if ((now - lastrotate) >= STATISTICS_DURATION) {
+                       lastrotate = now;
                        Object[] keys = targets.keySet().toArray();
+                       if(keys == null) return; // Why aren't we iterating 
there ?
                        for(int i = 0 ; i < keys.length ; i++) {
                                Object key = keys[i];
                                if 
(((StatisticEntry)(targets.get(key))).rotate() == false)
                                        targets.remove(key);
                        }
-                       lastrotate = now;
                        // FIXME: debugging
                        //_dumpInfo();
                }


Reply via email to