[freenet-cvs] r14591 - trunk/freenet/src/freenet/client

toad at freenetproject.org toad at freenetproject.org
Sat Aug 11 12:27:27 UTC 2007


Author: toad
Date: 2007-08-11 12:27:27 +0000 (Sat, 11 Aug 2007)
New Revision: 14591

Modified:
   trunk/freenet/src/freenet/client/ArchiveManager.java
Log:
Avoid NPE, log when the cache is full but there is nothing to dump from it.

Modified: trunk/freenet/src/freenet/client/ArchiveManager.java
===================================================================
--- trunk/freenet/src/freenet/client/ArchiveManager.java	2007-08-11 12:25:08 UTC (rev 14590)
+++ trunk/freenet/src/freenet/client/ArchiveManager.java	2007-08-11 12:27:27 UTC (rev 14591)
@@ -433,6 +433,11 @@
 			ArchiveStoreItem item;
 			synchronized(this) {
 				if(cachedData <= maxCachedData && storedData.size() <= maxCachedElements) return;
+				if(storedData.isEmpty()) {
+					// Race condition? cachedData out of sync?
+					Logger.error(this, "storedData is empty but still over limit: cachedData="+cachedData+" / "+maxCachedData);
+					return;
+				}
 				item = (ArchiveStoreItem) storedData.popValue();	
 			}
 			if(logMINOR)




More information about the cvs mailing list