changeset 9768:9507566f7100

8028285: RMI Thread can no longer call out to AWT Reviewed-by: art, serb, ddehaven
author pchelko
date Tue, 25 Feb 2014 19:38:45 +0400
parents 959cf9cf99cc
children 4fef97b3b7b7
files src/share/classes/sun/awt/AppContext.java
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/awt/AppContext.java	Thu Feb 20 23:16:37 2014 +0000
+++ b/src/share/classes/sun/awt/AppContext.java	Tue Feb 25 19:38:45 2014 +0400
@@ -329,6 +329,20 @@
                     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);