Fix concurrent modification exception

This commit is contained in:
Alexander Sytnyk 2018-02-02 14:25:53 +02:00
parent c8c2f03989
commit cd7628ae3d

View file

@ -88,7 +88,8 @@ public class IncrementalChangesManager {
if (!regionUpdateFiles.dayUpdates.isEmpty()) { if (!regionUpdateFiles.dayUpdates.isEmpty()) {
ArrayList<String> list = new ArrayList<String>(regionUpdateFiles.dayUpdates.keySet()); ArrayList<String> list = new ArrayList<String>(regionUpdateFiles.dayUpdates.keySet());
for (String month : list) { for (String month : list) {
Iterator<RegionUpdate> it = regionUpdateFiles.dayUpdates.get(month).iterator(); List<RegionUpdate> newList = new ArrayList<>(regionUpdateFiles.dayUpdates.get(month));
Iterator<RegionUpdate> it = newList.iterator();
RegionUpdate monthRu = regionUpdateFiles.monthUpdates.get(month); RegionUpdate monthRu = regionUpdateFiles.monthUpdates.get(month);
while (it.hasNext()) { while (it.hasNext()) {
RegionUpdate ru = it.next(); RegionUpdate ru = it.next();
@ -100,6 +101,7 @@ public class IncrementalChangesManager {
log.info("Delete overlapping day update " + ru.file.getName()); log.info("Delete overlapping day update " + ru.file.getName());
} }
} }
regionUpdateFiles.dayUpdates.put(month, newList);
} }
} }
} }