@@ -495,7 +495,9 @@ def __build_library_deploy_strategy(self, location, model_libs, existing_libs, e
495
495
stop_app_list , update_library_list ):
496
496
if model_libs is not None :
497
497
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 ():
499
501
for param in uses_path_tokens_model_attribute_names :
500
502
if param in lib_dict :
501
503
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
558
560
if model_apps is not None :
559
561
uses_path_tokens_model_attribute_names = self .__get_uses_path_tokens_attribute_names (location )
560
562
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 ():
562
565
for param in uses_path_tokens_model_attribute_names :
563
566
if param in app_dict :
564
567
self .model_context .replace_tokens (APPLICATION , app , param , app_dict )
0 commit comments