Skip to content

Commit 4ed3191

Browse files
rakillenddsharpe
authored andcommitted
Issue #469 - Use dict.items() in loops to prevent ConcurrentModificationException (#489)
1 parent af8551e commit 4ed3191

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,9 @@ def __build_library_deploy_strategy(self, location, model_libs, existing_libs, e
495495
stop_app_list, update_library_list):
496496
if model_libs is not None:
497497
uses_path_tokens_model_attribute_names = self.__get_uses_path_tokens_attribute_names(location)
498-
for lib, lib_dict in model_libs.iteritems():
498+
499+
# use items(), not iteritems(), to avoid ConcurrentModificationException if a lib is removed
500+
for lib, lib_dict in model_libs.items():
499501
for param in uses_path_tokens_model_attribute_names:
500502
if param in lib_dict:
501503
self.model_context.replace_tokens(LIBRARY, lib, param, lib_dict)
@@ -558,7 +560,8 @@ def __build_app_deploy_strategy(self, location, model_apps, existing_apps, exist
558560
if model_apps is not None:
559561
uses_path_tokens_model_attribute_names = self.__get_uses_path_tokens_attribute_names(location)
560562

561-
for app, app_dict in model_apps.iteritems():
563+
# use items(), not iteritems(), to avoid ConcurrentModificationException if an app is removed
564+
for app, app_dict in model_apps.items():
562565
for param in uses_path_tokens_model_attribute_names:
563566
if param in app_dict:
564567
self.model_context.replace_tokens(APPLICATION, app, param, app_dict)

0 commit comments

Comments
 (0)