Fix ConcurrentAccessException in unit tests

The ContentCache is now an LRU cache. This means we must NOT access the cache
while using any iterator over the cache. In this case, we were calling get()
using an iterator of cache keys.

Change-Id: I2d1feabff7474b6f2a230b98f97df067ab7ccd9c
This commit is contained in:
Todd Kennedy 2011-01-31 17:39:44 -08:00
parent 978e75ee90
commit f1b510462f

View File

@ -662,8 +662,7 @@ public final class ContentCache extends LinkedHashMap<String, Cursor> {
} }
mStats.mInvalidateCount++; mStats.mInvalidateCount++;
// Close all cached cursors that are no longer in use // Close all cached cursors that are no longer in use
for (String id: keySet()) { for (Cursor c: values()) {
Cursor c = get(id);
if (!sActiveCursors.contains(c)) { if (!sActiveCursors.contains(c)) {
c.close(); c.close();
} }