Skip to content

Commit 96b7886

Browse files
committed
Avoid ConcurrentModificationException in filter if dict is modified
1 parent 7c32434 commit 96b7886

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/python/wlsdeploy/tool/util/filters/model_traverse.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def traverse_section(self, model_section_key, model_dict, valid_section_folders)
3838
valid_attr_infos = self._aliases.get_model_attribute_names_and_types(attribute_location)
3939

4040
model_section_dict = model_dict[model_section_key]
41-
for section_dict_key, section_dict_value in model_section_dict.iteritems():
41+
# use items(), not iteritems(), to avoid ConcurrentModificationException if dict is modified
42+
for section_dict_key, section_dict_value in model_section_dict.items():
4243
# section_dict_key is the name of a folder or attribute in the section.
4344

4445
if section_dict_key in valid_attr_infos:
@@ -91,7 +92,8 @@ def traverse_node(self, model_node, model_location):
9192
valid_folder_keys = self._aliases.get_model_subfolder_names(model_location)
9293
valid_attr_infos = self._aliases.get_model_attribute_names_and_types(model_location)
9394

94-
for key, value in model_node.iteritems():
95+
# use items(), not iteritems(), to avoid ConcurrentModificationException if node is modified
96+
for key, value in model_node.items():
9597
if key in valid_folder_keys:
9698
new_location = LocationContext(model_location).append_location(key)
9799
self.traverse_folder(value, new_location)

0 commit comments

Comments
 (0)