Author: toad
Date: 2008-02-18 12:52:55 +0000 (Mon, 18 Feb 2008)
New Revision: 18036

Modified:
   trunk/freenet/src/freenet/client/async/RequestCooldownQueue.java
Log:
Don't let invalid holes count (shouldn't happen now anyway) cause expandQueue() 
to allocate an invalid/too small size array.

Modified: trunk/freenet/src/freenet/client/async/RequestCooldownQueue.java
===================================================================
--- trunk/freenet/src/freenet/client/async/RequestCooldownQueue.java    
2008-02-18 12:10:31 UTC (rev 18035)
+++ trunk/freenet/src/freenet/client/async/RequestCooldownQueue.java    
2008-02-18 12:52:55 UTC (rev 18036)
@@ -209,7 +209,10 @@
         */
        private synchronized void expandQueue() {
                if(logMINOR) Logger.minor(this, "Expanding queue");
-               if(holes < 0) Logger.error(this, "holes = "+holes+" !!");
+               if(holes < 0) {
+                       Logger.error(this, "holes = "+holes+" !!");
+                       holes = 0;
+               }
                int newSize = (keys.length - holes) * 2;
                // FIXME reuse the old buffers if it fits
                Key[] newKeys = new Key[newSize];


Reply via email to