From 4f65cdb6e31334c53b660c54e0b38e945e20b5c5 Mon Sep 17 00:00:00 2001 From: pchelko Date: Tue, 25 Feb 2014 19:38:45 +0400 Subject: [PATCH] 8028285: RMI Thread can no longer call out to AWT Reviewed-by: art, serb, ddehaven --- src/share/classes/sun/awt/AppContext.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/share/classes/sun/awt/AppContext.java b/src/share/classes/sun/awt/AppContext.java index c7f46efdf..e6381645b 100644 --- a/src/share/classes/sun/awt/AppContext.java +++ b/src/share/classes/sun/awt/AppContext.java @@ -329,6 +329,20 @@ public final class AppContext { while (context == null) { threadGroup = threadGroup.getParent(); if (threadGroup == null) { + // We've got up to the root thread group and did not find an AppContext + // Try to get it from the security manager + SecurityManager securityManager = System.getSecurityManager(); + if (securityManager != null) { + ThreadGroup smThreadGroup = securityManager.getThreadGroup(); + if (smThreadGroup != null) { + /* + * If we get this far then it's likely that + * the ThreadGroup does not actually belong + * to the applet, so do not cache it. + */ + return threadGroup2appContext.get(smThreadGroup); + } + } return null; } context = threadGroup2appContext.get(threadGroup); -- GitLab