@@ -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