< prev index next >

src/java.base/share/classes/java/lang/SecurityManager.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1995, 2017, 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) 1995, 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
*** 233,255 **** /* * Have we been initialized. Effective against finalizer attacks. */ private boolean initialized = false; - - /** - * returns true if the current context has been granted AllPermission - */ - private boolean hasAllPermission() { - try { - checkPermission(SecurityConstants.ALL_PERMISSION); - return true; - } catch (SecurityException se) { - return false; - } - } - /** * Constructs a new <code>SecurityManager</code>. * * <p> If there is a security manager already installed, this method first * calls the security manager's <code>checkPermission</code> method --- 233,242 ----
*** 1079,1110 **** checkPermission(new PropertyPermission(key, SecurityConstants.PROPERTY_READ_ACTION)); } /** - * Returns {@code true} if the calling thread has {@code AllPermission}. - * - * @param window not used except to check if it is {@code null}. - * @return {@code true} if the calling thread has {@code AllPermission}. - * @exception NullPointerException if the {@code window} argument is - * {@code null}. - * @deprecated This method was originally used to check if the calling thread - * was trusted to bring up a top-level window. The method has been - * obsoleted and code should instead use {@link #checkPermission} - * to check {@code AWTPermission("showWindowWithoutWarningBanner")}. - * This method is subject to removal in a future version of Java SE. - * @see #checkPermission(java.security.Permission) checkPermission - */ - @Deprecated(since="1.8", forRemoval=true) - public boolean checkTopLevelWindow(Object window) { - if (window == null) { - throw new NullPointerException("window can't be null"); - } - return hasAllPermission(); - } - - /** * Throws a <code>SecurityException</code> if the * calling thread is not allowed to initiate a print job request. * <p> * This method calls * <code>checkPermission</code> with the --- 1066,1075 ----
*** 1122,1169 **** */ public void checkPrintJobAccess() { checkPermission(new RuntimePermission("queuePrintJob")); } - /** - * Throws {@code SecurityException} if the calling thread does - * not have {@code AllPermission}. - * - * @since 1.1 - * @exception SecurityException if the calling thread does not have - * {@code AllPermission} - * @deprecated This method was originally used to check if the calling - * thread could access the system clipboard. The method has been - * obsoleted and code should instead use {@link #checkPermission} - * to check {@code AWTPermission("accessClipboard")}. - * This method is subject to removal in a future version of Java SE. - * @see #checkPermission(java.security.Permission) checkPermission - */ - @Deprecated(since="1.8", forRemoval=true) - public void checkSystemClipboardAccess() { - checkPermission(SecurityConstants.ALL_PERMISSION); - } - - /** - * Throws {@code SecurityException} if the calling thread does - * not have {@code AllPermission}. - * - * @since 1.1 - * @exception SecurityException if the calling thread does not have - * {@code AllPermission} - * @deprecated This method was originally used to check if the calling - * thread could access the AWT event queue. The method has been - * obsoleted and code should instead use {@link #checkPermission} - * to check {@code AWTPermission("accessEventQueue")}. - * This method is subject to removal in a future version of Java SE. - * @see #checkPermission(java.security.Permission) checkPermission - */ - @Deprecated(since="1.8", forRemoval=true) - public void checkAwtEventQueueAccess() { - checkPermission(SecurityConstants.ALL_PERMISSION); - } - /* * We have an initial invalid bit (initially false) for the class * variables which tell if the cache is valid. If the underlying * java.security.Security property changes via setProperty(), the * Security class uses reflection to change the variable and thus --- 1087,1096 ----
*** 1473,1511 **** public void checkSetFactory() { checkPermission(new RuntimePermission("setFactory")); } /** - * Throws a {@code SecurityException} if the calling thread does - * not have {@code AllPermission}. - * - * @param clazz the class that reflection is to be performed on. - * @param which type of access, PUBLIC or DECLARED. - * @throws SecurityException if the caller does not have - * {@code AllPermission} - * @throws NullPointerException if the {@code clazz} argument is - * {@code null} - * @deprecated This method was originally used to check if the calling - * thread was allowed to access members. It relied on the - * caller being at a stack depth of 4 which is error-prone and - * cannot be enforced by the runtime. The method has been - * obsoleted and code should instead use - * {@link #checkPermission} to check - * {@code RuntimePermission("accessDeclaredMembers")}. This - * method is subject to removal in a future version of Java SE. - * @since 1.1 - * @see #checkPermission(java.security.Permission) checkPermission - */ - @Deprecated(since="1.8", forRemoval=true) - public void checkMemberAccess(Class<?> clazz, int which) { - if (clazz == null) { - throw new NullPointerException("class can't be null"); - } - checkPermission(SecurityConstants.ALL_PERMISSION); - } - - /** * Determines whether the permission with the specified permission target * name should be granted or denied. * * <p> If the requested permission is allowed, this method returns * quietly. If denied, a SecurityException is raised. --- 1400,1409 ----
< prev index next >