Permalink
Browse files

Possible bug fix for "java.util.ConcurrentModificationException" that…

… sometimes occurs.
  • Loading branch information...
1 parent 4b013df commit f80edb9ba15cc3ec2910c7e7d4e0143b9ee79c22 Stefano Dacchille committed Jun 24, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/main/java/com/github/droidfu/cachefu/CachedList.java
@@ -170,8 +170,11 @@ public synchronized String createKey(String id) {
public boolean reload(ModelCache modelCache) {
// First reload list object
boolean result = super.reload(modelCache);
- // Then reload each item in list
- for (CachedModel listModel : list) {
+ // Then reload each item in list. Sometimes a ConcurrentModificationException occurs.
+ // Changed implementation so that it doesn't use an Iterator any more.
+ // Uglier but hopefully that will solve the issue.
+ for (int i = 0; i < list.size(); i++) {
+ CachedModel listModel = list.get(i);
if (listModel.reload(modelCache)) {
result = true;
}

0 comments on commit f80edb9

Please sign in to comment.