Module java.base
Package java.security

Class AccessControlException

所有已实现的接口:
Serializable

@Deprecated(since="17", forRemoval=true) public class AccessControlException extends SecurityException
Deprecated, for removal: This API element is subject to removal in a future version.
This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

此异常由AccessController抛出,表示拒绝对关键系统资源(如文件系统或网络)的请求访问。

拒绝访问的原因可能各不相同。例如,请求的权限可能是错误类型,包含无效值,或者根据安全策略不允许请求访问。应尽可能在抛出异常时提供此类信息。

自版本:
1.2
参见:
  • Constructor Details

    • AccessControlException

      public AccessControlException(String s)
      Deprecated, for removal: This API element is subject to removal in a future version.
      构造具有指定详细消息的AccessControlException
      参数:
      s - 详细消息。
    • AccessControlException

      public AccessControlException(String s, Permission p)
      Deprecated, for removal: This API element is subject to removal in a future version.
      构造具有指定详细消息和导致异常的请求权限的AccessControlException
      参数:
      s - 详细消息。
      p - 导致异常的权限。
  • Method Details

    • getPermission

      public Permission getPermission()
      Deprecated, for removal: This API element is subject to removal in a future version.
      获取与此异常关联的Permission对象,如果没有相应的Permission对象,则返回null
      返回:
      Permission对象。