< prev index next >

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

Print this page
rev 56290 : 8230648: Replace @exception tag with @throws in java.base
Summary: Minor coding style update of javadoc tag in any file in java.base
Reviewed-by: prappo, lancea

*** 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 --- 1,7 ---- /* ! * Copyright (c) 1995, 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
*** 329,339 **** * with the <code>RuntimePermission("createSecurityManager")</code> * permission to ensure the calling thread has permission to create a new * security manager. * This may result in throwing a <code>SecurityException</code>. * ! * @exception java.lang.SecurityException if a security manager already * exists and its <code>checkPermission</code> method * doesn't allow creation of a new security manager. * @see java.lang.System#getSecurityManager() * @see #checkPermission(java.security.Permission) checkPermission * @see java.lang.RuntimePermission --- 329,339 ---- * with the <code>RuntimePermission("createSecurityManager")</code> * permission to ensure the calling thread has permission to create a new * security manager. * This may result in throwing a <code>SecurityException</code>. * ! * @throws java.lang.SecurityException if a security manager already * exists and its <code>checkPermission</code> method * doesn't allow creation of a new security manager. * @see java.lang.System#getSecurityManager() * @see #checkPermission(java.security.Permission) checkPermission * @see java.lang.RuntimePermission
*** 396,408 **** * <p> * This method calls <code>AccessController.checkPermission</code> * with the given permission. * * @param perm the requested permission. ! * @exception SecurityException if access is not permitted based on * the current security policy. ! * @exception NullPointerException if the permission argument is * <code>null</code>. * @since 1.2 */ public void checkPermission(Permission perm) { java.security.AccessController.checkPermission(perm); --- 396,408 ---- * <p> * This method calls <code>AccessController.checkPermission</code> * with the given permission. * * @param perm the requested permission. ! * @throws SecurityException if access is not permitted based on * the current security policy. ! * @throws NullPointerException if the permission argument is * <code>null</code>. * @since 1.2 */ public void checkPermission(Permission perm) { java.security.AccessController.checkPermission(perm);
*** 427,441 **** * <code>AccessControlContext</code> then a * <code>SecurityException</code> is thrown. * * @param perm the specified permission * @param context a system-dependent security context. ! * @exception SecurityException if the specified security context * is not an instance of <code>AccessControlContext</code> * (e.g., is <code>null</code>), or is denied access to the * resource specified by the given permission. ! * @exception NullPointerException if the permission argument is * <code>null</code>. * @see java.lang.SecurityManager#getSecurityContext() * @see java.security.AccessControlContext#checkPermission(java.security.Permission) * @since 1.2 */ --- 427,441 ---- * <code>AccessControlContext</code> then a * <code>SecurityException</code> is thrown. * * @param perm the specified permission * @param context a system-dependent security context. ! * @throws SecurityException if the specified security context * is not an instance of <code>AccessControlContext</code> * (e.g., is <code>null</code>), or is denied access to the * resource specified by the given permission. ! * @throws NullPointerException if the permission argument is * <code>null</code>. * @see java.lang.SecurityManager#getSecurityContext() * @see java.security.AccessControlContext#checkPermission(java.security.Permission) * @since 1.2 */
*** 458,468 **** * If you override this method, then you should make a call to * <code>super.checkCreateClassLoader</code> * at the point the overridden method would normally throw an * exception. * ! * @exception SecurityException if the calling thread does not * have permission * to create a new class loader. * @see java.lang.ClassLoader#ClassLoader() * @see #checkPermission(java.security.Permission) checkPermission */ --- 458,468 ---- * If you override this method, then you should make a call to * <code>super.checkCreateClassLoader</code> * at the point the overridden method would normally throw an * exception. * ! * @throws SecurityException if the calling thread does not * have permission * to create a new class loader. * @see java.lang.ClassLoader#ClassLoader() * @see #checkPermission(java.security.Permission) checkPermission */
*** 513,525 **** * <code>super.checkAccess</code> should * be called by the first statement in the overridden method, or the * equivalent security check should be placed in the overridden method. * * @param t the thread to be checked. ! * @exception SecurityException if the calling thread does not have * permission to modify the thread. ! * @exception NullPointerException if the thread argument is * <code>null</code>. * @see java.lang.Thread#resume() resume * @see java.lang.Thread#setDaemon(boolean) setDaemon * @see java.lang.Thread#setName(java.lang.String) setName * @see java.lang.Thread#setPriority(int) setPriority --- 513,525 ---- * <code>super.checkAccess</code> should * be called by the first statement in the overridden method, or the * equivalent security check should be placed in the overridden method. * * @param t the thread to be checked. ! * @throws SecurityException if the calling thread does not have * permission to modify the thread. ! * @throws NullPointerException if the thread argument is * <code>null</code>. * @see java.lang.Thread#resume() resume * @see java.lang.Thread#setDaemon(boolean) setDaemon * @see java.lang.Thread#setName(java.lang.String) setName * @see java.lang.Thread#setPriority(int) setPriority
*** 566,578 **** * <code>super.checkAccess</code> should * be called by the first statement in the overridden method, or the * equivalent security check should be placed in the overridden method. * * @param g the thread group to be checked. ! * @exception SecurityException if the calling thread does not have * permission to modify the thread group. ! * @exception NullPointerException if the thread group argument is * <code>null</code>. * @see java.lang.ThreadGroup#destroy() destroy * @see java.lang.ThreadGroup#resume() resume * @see java.lang.ThreadGroup#setDaemon(boolean) setDaemon * @see java.lang.ThreadGroup#setMaxPriority(int) setMaxPriority --- 566,578 ---- * <code>super.checkAccess</code> should * be called by the first statement in the overridden method, or the * equivalent security check should be placed in the overridden method. * * @param g the thread group to be checked. ! * @throws SecurityException if the calling thread does not have * permission to modify the thread group. ! * @throws NullPointerException if the thread group argument is * <code>null</code>. * @see java.lang.ThreadGroup#destroy() destroy * @see java.lang.ThreadGroup#resume() resume * @see java.lang.ThreadGroup#setDaemon(boolean) setDaemon * @see java.lang.ThreadGroup#setMaxPriority(int) setMaxPriority
*** 608,618 **** * <code>super.checkExit</code> * at the point the overridden method would normally throw an * exception. * * @param status the exit status. ! * @exception SecurityException if the calling thread does not have * permission to halt the Java Virtual Machine with * the specified status. * @see java.lang.Runtime#exit(int) exit * @see #checkPermission(java.security.Permission) checkPermission */ --- 608,618 ---- * <code>super.checkExit</code> * at the point the overridden method would normally throw an * exception. * * @param status the exit status. ! * @throws SecurityException if the calling thread does not have * permission to halt the Java Virtual Machine with * the specified status. * @see java.lang.Runtime#exit(int) exit * @see #checkPermission(java.security.Permission) checkPermission */
*** 637,649 **** * <code>super.checkExec</code> * at the point the overridden method would normally throw an * exception. * * @param cmd the specified system command. ! * @exception SecurityException if the calling thread does not have * permission to create a subprocess. ! * @exception NullPointerException if the <code>cmd</code> argument is * <code>null</code>. * @see java.lang.Runtime#exec(java.lang.String) * @see java.lang.Runtime#exec(java.lang.String, java.lang.String[]) * @see java.lang.Runtime#exec(java.lang.String[]) * @see java.lang.Runtime#exec(java.lang.String[], java.lang.String[]) --- 637,649 ---- * <code>super.checkExec</code> * at the point the overridden method would normally throw an * exception. * * @param cmd the specified system command. ! * @throws SecurityException if the calling thread does not have * permission to create a subprocess. ! * @throws NullPointerException if the <code>cmd</code> argument is * <code>null</code>. * @see java.lang.Runtime#exec(java.lang.String) * @see java.lang.Runtime#exec(java.lang.String, java.lang.String[]) * @see java.lang.Runtime#exec(java.lang.String[]) * @see java.lang.Runtime#exec(java.lang.String[], java.lang.String[])
*** 677,689 **** * <code>super.checkLink</code> * at the point the overridden method would normally throw an * exception. * * @param lib the name of the library. ! * @exception SecurityException if the calling thread does not have * permission to dynamically link the library. ! * @exception NullPointerException if the <code>lib</code> argument is * <code>null</code>. * @see java.lang.Runtime#load(java.lang.String) * @see java.lang.Runtime#loadLibrary(java.lang.String) * @see #checkPermission(java.security.Permission) checkPermission */ --- 677,689 ---- * <code>super.checkLink</code> * at the point the overridden method would normally throw an * exception. * * @param lib the name of the library. ! * @throws SecurityException if the calling thread does not have * permission to dynamically link the library. ! * @throws NullPointerException if the <code>lib</code> argument is * <code>null</code>. * @see java.lang.Runtime#load(java.lang.String) * @see java.lang.Runtime#loadLibrary(java.lang.String) * @see #checkPermission(java.security.Permission) checkPermission */
*** 707,719 **** * <code>super.checkRead</code> * at the point the overridden method would normally throw an * exception. * * @param fd the system-dependent file descriptor. ! * @exception SecurityException if the calling thread does not have * permission to access the specified file descriptor. ! * @exception NullPointerException if the file descriptor argument is * <code>null</code>. * @see java.io.FileDescriptor * @see #checkPermission(java.security.Permission) checkPermission */ public void checkRead(FileDescriptor fd) { --- 707,719 ---- * <code>super.checkRead</code> * at the point the overridden method would normally throw an * exception. * * @param fd the system-dependent file descriptor. ! * @throws SecurityException if the calling thread does not have * permission to access the specified file descriptor. ! * @throws NullPointerException if the file descriptor argument is * <code>null</code>. * @see java.io.FileDescriptor * @see #checkPermission(java.security.Permission) checkPermission */ public void checkRead(FileDescriptor fd) {
*** 735,747 **** * <code>super.checkRead</code> * at the point the overridden method would normally throw an * exception. * * @param file the system-dependent file name. ! * @exception SecurityException if the calling thread does not have * permission to access the specified file. ! * @exception NullPointerException if the <code>file</code> argument is * <code>null</code>. * @see #checkPermission(java.security.Permission) checkPermission */ public void checkRead(String file) { checkPermission(new FilePermission(file, --- 735,747 ---- * <code>super.checkRead</code> * at the point the overridden method would normally throw an * exception. * * @param file the system-dependent file name. ! * @throws SecurityException if the calling thread does not have * permission to access the specified file. ! * @throws NullPointerException if the <code>file</code> argument is * <code>null</code>. * @see #checkPermission(java.security.Permission) checkPermission */ public void checkRead(String file) { checkPermission(new FilePermission(file,
*** 767,781 **** * at the point the overridden method would normally throw an * exception. * * @param file the system-dependent filename. * @param context a system-dependent security context. ! * @exception SecurityException if the specified security context * is not an instance of <code>AccessControlContext</code> * (e.g., is <code>null</code>), or does not have permission * to read the specified file. ! * @exception NullPointerException if the <code>file</code> argument is * <code>null</code>. * @see java.lang.SecurityManager#getSecurityContext() * @see java.security.AccessControlContext#checkPermission(java.security.Permission) */ public void checkRead(String file, Object context) { --- 767,781 ---- * at the point the overridden method would normally throw an * exception. * * @param file the system-dependent filename. * @param context a system-dependent security context. ! * @throws SecurityException if the specified security context * is not an instance of <code>AccessControlContext</code> * (e.g., is <code>null</code>), or does not have permission * to read the specified file. ! * @throws NullPointerException if the <code>file</code> argument is * <code>null</code>. * @see java.lang.SecurityManager#getSecurityContext() * @see java.security.AccessControlContext#checkPermission(java.security.Permission) */ public void checkRead(String file, Object context) {
*** 797,809 **** * <code>super.checkWrite</code> * at the point the overridden method would normally throw an * exception. * * @param fd the system-dependent file descriptor. ! * @exception SecurityException if the calling thread does not have * permission to access the specified file descriptor. ! * @exception NullPointerException if the file descriptor argument is * <code>null</code>. * @see java.io.FileDescriptor * @see #checkPermission(java.security.Permission) checkPermission */ public void checkWrite(FileDescriptor fd) { --- 797,809 ---- * <code>super.checkWrite</code> * at the point the overridden method would normally throw an * exception. * * @param fd the system-dependent file descriptor. ! * @throws SecurityException if the calling thread does not have * permission to access the specified file descriptor. ! * @throws NullPointerException if the file descriptor argument is * <code>null</code>. * @see java.io.FileDescriptor * @see #checkPermission(java.security.Permission) checkPermission */ public void checkWrite(FileDescriptor fd) {
*** 826,838 **** * <code>super.checkWrite</code> * at the point the overridden method would normally throw an * exception. * * @param file the system-dependent filename. ! * @exception SecurityException if the calling thread does not * have permission to access the specified file. ! * @exception NullPointerException if the <code>file</code> argument is * <code>null</code>. * @see #checkPermission(java.security.Permission) checkPermission */ public void checkWrite(String file) { checkPermission(new FilePermission(file, --- 826,838 ---- * <code>super.checkWrite</code> * at the point the overridden method would normally throw an * exception. * * @param file the system-dependent filename. ! * @throws SecurityException if the calling thread does not * have permission to access the specified file. ! * @throws NullPointerException if the <code>file</code> argument is * <code>null</code>. * @see #checkPermission(java.security.Permission) checkPermission */ public void checkWrite(String file) { checkPermission(new FilePermission(file,
*** 853,865 **** * <code>super.checkDelete</code> * at the point the overridden method would normally throw an * exception. * * @param file the system-dependent filename. ! * @exception SecurityException if the calling thread does not * have permission to delete the file. ! * @exception NullPointerException if the <code>file</code> argument is * <code>null</code>. * @see java.io.File#delete() * @see #checkPermission(java.security.Permission) checkPermission */ public void checkDelete(String file) { --- 853,865 ---- * <code>super.checkDelete</code> * at the point the overridden method would normally throw an * exception. * * @param file the system-dependent filename. ! * @throws SecurityException if the calling thread does not * have permission to delete the file. ! * @throws NullPointerException if the <code>file</code> argument is * <code>null</code>. * @see java.io.File#delete() * @see #checkPermission(java.security.Permission) checkPermission */ public void checkDelete(String file) {
*** 887,900 **** * at the point the overridden method would normally throw an * exception. * * @param host the host name port to connect to. * @param port the protocol port to connect to. ! * @exception SecurityException if the calling thread does not have * permission to open a socket connection to the specified * <code>host</code> and <code>port</code>. ! * @exception NullPointerException if the <code>host</code> argument is * <code>null</code>. * @see #checkPermission(java.security.Permission) checkPermission */ public void checkConnect(String host, int port) { if (host == null) { --- 887,900 ---- * at the point the overridden method would normally throw an * exception. * * @param host the host name port to connect to. * @param port the protocol port to connect to. ! * @throws SecurityException if the calling thread does not have * permission to open a socket connection to the specified * <code>host</code> and <code>port</code>. ! * @throws NullPointerException if the <code>host</code> argument is * <code>null</code>. * @see #checkPermission(java.security.Permission) checkPermission */ public void checkConnect(String host, int port) { if (host == null) {
*** 939,954 **** * exception. * * @param host the host name port to connect to. * @param port the protocol port to connect to. * @param context a system-dependent security context. ! * @exception SecurityException if the specified security context * is not an instance of <code>AccessControlContext</code> * (e.g., is <code>null</code>), or does not have permission * to open a socket connection to the specified * <code>host</code> and <code>port</code>. ! * @exception NullPointerException if the <code>host</code> argument is * <code>null</code>. * @see java.lang.SecurityManager#getSecurityContext() * @see java.security.AccessControlContext#checkPermission(java.security.Permission) */ public void checkConnect(String host, int port, Object context) { --- 939,954 ---- * exception. * * @param host the host name port to connect to. * @param port the protocol port to connect to. * @param context a system-dependent security context. ! * @throws SecurityException if the specified security context * is not an instance of <code>AccessControlContext</code> * (e.g., is <code>null</code>), or does not have permission * to open a socket connection to the specified * <code>host</code> and <code>port</code>. ! * @throws NullPointerException if the <code>host</code> argument is * <code>null</code>. * @see java.lang.SecurityManager#getSecurityContext() * @see java.security.AccessControlContext#checkPermission(java.security.Permission) */ public void checkConnect(String host, int port, Object context) {
*** 980,990 **** * <code>super.checkListen</code> * at the point the overridden method would normally throw an * exception. * * @param port the local port. ! * @exception SecurityException if the calling thread does not have * permission to listen on the specified port. * @see #checkPermission(java.security.Permission) checkPermission */ public void checkListen(int port) { checkPermission(new SocketPermission("localhost:"+port, --- 980,990 ---- * <code>super.checkListen</code> * at the point the overridden method would normally throw an * exception. * * @param port the local port. ! * @throws SecurityException if the calling thread does not have * permission to listen on the specified port. * @see #checkPermission(java.security.Permission) checkPermission */ public void checkListen(int port) { checkPermission(new SocketPermission("localhost:"+port,
*** 1007,1019 **** * at the point the overridden method would normally throw an * exception. * * @param host the host name of the socket connection. * @param port the port number of the socket connection. ! * @exception SecurityException if the calling thread does not have * permission to accept the connection. ! * @exception NullPointerException if the <code>host</code> argument is * <code>null</code>. * @see java.net.ServerSocket#accept() * @see #checkPermission(java.security.Permission) checkPermission */ public void checkAccept(String host, int port) { --- 1007,1019 ---- * at the point the overridden method would normally throw an * exception. * * @param host the host name of the socket connection. * @param port the port number of the socket connection. ! * @throws SecurityException if the calling thread does not have * permission to accept the connection. ! * @throws NullPointerException if the <code>host</code> argument is * <code>null</code>. * @see java.net.ServerSocket#accept() * @see #checkPermission(java.security.Permission) checkPermission */ public void checkAccept(String host, int port) {
*** 1040,1052 **** * <code>super.checkMulticast</code> * at the point the overridden method would normally throw an * exception. * * @param maddr Internet group address to be used. ! * @exception SecurityException if the calling thread is not allowed to * use (join/leave/send/receive) IP multicast. ! * @exception NullPointerException if the address argument is * <code>null</code>. * @since 1.1 * @see #checkPermission(java.security.Permission) checkPermission */ public void checkMulticast(InetAddress maddr) { --- 1040,1052 ---- * <code>super.checkMulticast</code> * at the point the overridden method would normally throw an * exception. * * @param maddr Internet group address to be used. ! * @throws SecurityException if the calling thread is not allowed to * use (join/leave/send/receive) IP multicast. ! * @throws NullPointerException if the address argument is * <code>null</code>. * @since 1.1 * @see #checkPermission(java.security.Permission) checkPermission */ public void checkMulticast(InetAddress maddr) {
*** 1074,1086 **** * * @param maddr Internet group address to be used. * @param ttl value in use, if it is multicast send. * Note: this particular implementation does not use the ttl * parameter. ! * @exception SecurityException if the calling thread is not allowed to * use (join/leave/send/receive) IP multicast. ! * @exception NullPointerException if the address argument is * <code>null</code>. * @since 1.1 * @deprecated Use #checkPermission(java.security.Permission) instead * @see #checkPermission(java.security.Permission) checkPermission */ --- 1074,1086 ---- * * @param maddr Internet group address to be used. * @param ttl value in use, if it is multicast send. * Note: this particular implementation does not use the ttl * parameter. ! * @throws SecurityException if the calling thread is not allowed to * use (join/leave/send/receive) IP multicast. ! * @throws NullPointerException if the address argument is * <code>null</code>. * @since 1.1 * @deprecated Use #checkPermission(java.security.Permission) instead * @see #checkPermission(java.security.Permission) checkPermission */
*** 1108,1118 **** * If you override this method, then you should make a call to * <code>super.checkPropertiesAccess</code> * at the point the overridden method would normally throw an * exception. * ! * @exception SecurityException if the calling thread does not have * permission to access or modify the system properties. * @see java.lang.System#getProperties() * @see java.lang.System#setProperties(java.util.Properties) * @see #checkPermission(java.security.Permission) checkPermission */ --- 1108,1118 ---- * If you override this method, then you should make a call to * <code>super.checkPropertiesAccess</code> * at the point the overridden method would normally throw an * exception. * ! * @throws SecurityException if the calling thread does not have * permission to access or modify the system properties. * @see java.lang.System#getProperties() * @see java.lang.System#setProperties(java.util.Properties) * @see #checkPermission(java.security.Permission) checkPermission */
*** 1137,1151 **** * at the point the overridden method would normally throw an * exception. * * @param key a system property key. * ! * @exception SecurityException if the calling thread does not have * permission to access the specified system property. ! * @exception NullPointerException if the <code>key</code> argument is * <code>null</code>. ! * @exception IllegalArgumentException if <code>key</code> is empty. * * @see java.lang.System#getProperty(java.lang.String) * @see #checkPermission(java.security.Permission) checkPermission */ public void checkPropertyAccess(String key) { --- 1137,1151 ---- * at the point the overridden method would normally throw an * exception. * * @param key a system property key. * ! * @throws SecurityException if the calling thread does not have * permission to access the specified system property. ! * @throws NullPointerException if the <code>key</code> argument is * <code>null</code>. ! * @throws IllegalArgumentException if <code>key</code> is empty. * * @see java.lang.System#getProperty(java.lang.String) * @see #checkPermission(java.security.Permission) checkPermission */ public void checkPropertyAccess(String key) {
*** 1164,1174 **** * If you override this method, then you should make a call to * <code>super.checkPrintJobAccess</code> * at the point the overridden method would normally throw an * exception. * ! * @exception SecurityException if the calling thread does not have * permission to initiate a print job request. * @since 1.1 * @see #checkPermission(java.security.Permission) checkPermission */ public void checkPrintJobAccess() { --- 1164,1174 ---- * If you override this method, then you should make a call to * <code>super.checkPrintJobAccess</code> * at the point the overridden method would normally throw an * exception. * ! * @throws SecurityException if the calling thread does not have * permission to initiate a print job request. * @since 1.1 * @see #checkPermission(java.security.Permission) checkPermission */ public void checkPrintJobAccess() {
*** 1472,1482 **** * If you override this method, then you should make a call to * <code>super.checkSetFactory</code> * at the point the overridden method would normally throw an * exception. * ! * @exception SecurityException if the calling thread does not have * permission to specify a socket factory or a stream * handler factory. * * @see java.net.ServerSocket#setSocketFactory(java.net.SocketImplFactory) setSocketFactory * @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory) setSocketImplFactory --- 1472,1482 ---- * If you override this method, then you should make a call to * <code>super.checkSetFactory</code> * at the point the overridden method would normally throw an * exception. * ! * @throws SecurityException if the calling thread does not have * permission to specify a socket factory or a stream * handler factory. * * @see java.net.ServerSocket#setSocketFactory(java.net.SocketImplFactory) setSocketFactory * @see java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory) setSocketImplFactory
*** 1507,1520 **** * at the point the overridden method would normally throw an * exception. * * @param target the target name of the <code>SecurityPermission</code>. * ! * @exception SecurityException if the calling thread does not have * permission for the requested access. ! * @exception NullPointerException if <code>target</code> is null. ! * @exception IllegalArgumentException if <code>target</code> is empty. * * @since 1.1 * @see #checkPermission(java.security.Permission) checkPermission */ public void checkSecurityAccess(String target) { --- 1507,1520 ---- * at the point the overridden method would normally throw an * exception. * * @param target the target name of the <code>SecurityPermission</code>. * ! * @throws SecurityException if the calling thread does not have * permission for the requested access. ! * @throws NullPointerException if <code>target</code> is null. ! * @throws IllegalArgumentException if <code>target</code> is empty. * * @since 1.1 * @see #checkPermission(java.security.Permission) checkPermission */ public void checkSecurityAccess(String target) {
< prev index next >