< prev index next >

src/java.desktop/share/classes/sun/awt/AppContext.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 121,141 **** * service support to applets, none of its methods may be blocked by a * a SecurityManager check in a valid Java implementation. Applets may * therefore safely invoke any of its methods without worry of being * blocked. * - * Note: If a SecurityManager is installed which derives from - * sun.awt.AWTSecurityManager, it may override the - * AWTSecurityManager.getAppContext() method to return the proper - * AppContext based on the execution context, in the case where - * the default ThreadGroup-based AppContext indexing would return - * the main "system" AppContext. For example, in an applet situation, - * if a system thread calls into an applet, rather than returning the - * main "system" AppContext (the one corresponding to the system thread), - * an installed AWTSecurityManager may return the applet's AppContext - * based on the execution context. - * * @author Thomas Ball * @author Fred Ecks */ public final class AppContext { private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.AppContext"); --- 121,130 ----
*** 285,298 **** }); } /** * Returns the appropriate AppContext for the caller, ! * as determined by its ThreadGroup. If the main "system" AppContext ! * would be returned and there's an AWTSecurityManager installed, it ! * is called to get the proper AppContext based on the execution ! * context. * * @return the AppContext for the caller. * @see java.lang.ThreadGroup * @since 1.2 */ --- 274,284 ---- }); } /** * Returns the appropriate AppContext for the caller, ! * as determined by its ThreadGroup. * * @return the AppContext for the caller. * @see java.lang.ThreadGroup * @since 1.2 */
*** 382,403 **** */ public static boolean isMainContext(AppContext ctx) { return (ctx != null && ctx == mainAppContext); } - private static AppContext getExecutionAppContext() { - SecurityManager securityManager = System.getSecurityManager(); - if ((securityManager != null) && - (securityManager instanceof AWTSecurityManager)) - { - AWTSecurityManager awtSecMgr = (AWTSecurityManager) securityManager; - AppContext secAppContext = awtSecMgr.getAppContext(); - return secAppContext; // Return what we're told - } - return null; - } - private long DISPOSAL_TIMEOUT = 5000; // Default to 5-second timeout // for disposal of all Frames // (we wait for this time twice, // once for dispose(), and once // to clear the EventQueue). --- 368,377 ----
*** 870,881 **** // it means that no AppContext has been created yet, and // we don't want to trigger the creation of a main app // context since we don't need it. if (numAppContexts.get() == 0) return null; ! // Get the context from the security manager ! AppContext ecx = getExecutionAppContext(); // Not sure we really need to re-check numAppContexts here. // If all applets have gone away then we could have a // numAppContexts coming back to 0. So we recheck // it here because we don't want to trigger the --- 844,854 ---- // it means that no AppContext has been created yet, and // we don't want to trigger the creation of a main app // context since we don't need it. if (numAppContexts.get() == 0) return null; ! AppContext ecx = null; // Not sure we really need to re-check numAppContexts here. // If all applets have gone away then we could have a // numAppContexts coming back to 0. So we recheck // it here because we don't want to trigger the
< prev index next >