Skip to content

Commit

Permalink
core: Fix ConcurrentModificationException in ConfigSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
TheElectronWill committed Aug 2, 2017
1 parent c03c472 commit 78d2eeb
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -590,13 +591,14 @@ private int correct(Map<String, Object> configMap, Map<String, Object> specMap,
}
}
// Second step: removes the unspecified values
for (Map.Entry<String, Object> configEntry : configMap.entrySet()) {
for (Iterator<Map.Entry<String, Object>> it = configMap.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> configEntry = it.next();
final String key = configEntry.getKey();
final Object configValue = configEntry.getValue();
final Object specValue = specMap.get(key);
if (specValue == null) {
// Removes the value and notifies the listener:
configMap.remove(key);
it.remove();
handleCorrection(parentPath, key, configValue, null, listener, REMOVE);
count++;
}
Expand Down

0 comments on commit 78d2eeb

Please sign in to comment.