6636331: ConcurrentModificationException in AppContext code
Summary: Added synchronization to AppContext.getAppContexts()
Reviewed-by: art
--- a/jdk/src/share/classes/sun/awt/AppContext.java Thu Mar 13 16:47:40 2008 +0300
+++ b/jdk/src/share/classes/sun/awt/AppContext.java Thu Mar 13 16:51:04 2008 +0300
@@ -146,7 +146,9 @@
* Returns a set containing all <code>AppContext</code>s.
*/
public static Set<AppContext> getAppContexts() {
- return new HashSet<AppContext>(threadGroup2appContext.values());
+ synchronized (threadGroup2appContext) {
+ return new HashSet<AppContext>(threadGroup2appContext.values());
+ }
}
/* The main "system" AppContext, used by everything not otherwise