From f1b510462fad73de1e7f7bfad2f0637c9cf65cd7 Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Mon, 31 Jan 2011 17:39:44 -0800 Subject: [PATCH] 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 --- src/com/android/email/provider/ContentCache.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/com/android/email/provider/ContentCache.java b/src/com/android/email/provider/ContentCache.java index aaee88e00..662fa2f42 100644 --- a/src/com/android/email/provider/ContentCache.java +++ b/src/com/android/email/provider/ContentCache.java @@ -662,8 +662,7 @@ public final class ContentCache extends LinkedHashMap { } mStats.mInvalidateCount++; // Close all cached cursors that are no longer in use - for (String id: keySet()) { - Cursor c = get(id); + for (Cursor c: values()) { if (!sActiveCursors.contains(c)) { c.close(); }