Skip to content

Issue #469 - Use dict.items() in loops to prevent ConcurrentModificat… #489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,9 @@ def __build_library_deploy_strategy(self, location, model_libs, existing_libs, e
stop_app_list, update_library_list):
if model_libs is not None:
uses_path_tokens_model_attribute_names = self.__get_uses_path_tokens_attribute_names(location)
for lib, lib_dict in model_libs.iteritems():

# use items(), not iteritems(), to avoid ConcurrentModificationException if a lib is removed
for lib, lib_dict in model_libs.items():
for param in uses_path_tokens_model_attribute_names:
if param in lib_dict:
self.model_context.replace_tokens(LIBRARY, lib, param, lib_dict)
Expand Down Expand Up @@ -558,7 +560,8 @@ def __build_app_deploy_strategy(self, location, model_apps, existing_apps, exist
if model_apps is not None:
uses_path_tokens_model_attribute_names = self.__get_uses_path_tokens_attribute_names(location)

for app, app_dict in model_apps.iteritems():
# use items(), not iteritems(), to avoid ConcurrentModificationException if an app is removed
for app, app_dict in model_apps.items():
for param in uses_path_tokens_model_attribute_names:
if param in app_dict:
self.model_context.replace_tokens(APPLICATION, app, param, app_dict)
Expand Down