HADOOP-15865. ConcurrentModificationException in Configuration.overlay() method. Contributed by Oleksandr Shevchenko.

(cherry picked from commit e872ceb810)
This commit is contained in:
Wei-Chiu Chuang 2019-08-01 19:56:51 -07:00
parent f42c8a44ae
commit 46e72775f5
1 changed files with 4 additions and 2 deletions

View File

@ -3406,8 +3406,10 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
}
private void overlay(Properties to, Properties from) {
for (Entry<Object, Object> entry: from.entrySet()) {
to.put(entry.getKey(), entry.getValue());
synchronized (from) {
for (Entry<Object, Object> entry : from.entrySet()) {
to.put(entry.getKey(), entry.getValue());
}
}
}