1. /*
  2. * @(#)AccessControlException.java 1.9 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.security;
  11. /**
  12. * <p> This exception is thrown by the AccessController to indicate
  13. * that a requested access (to a critical system resource such as the
  14. * file system or the network) is denied.
  15. *
  16. * <p> The reason to deny access can vary. For example, the requested
  17. * permission might be of an incorrect type, contain an invalid
  18. * value, or request access that is not allowed according to the
  19. * security policy. Such information should be given whenever
  20. * possible at the time the exception is thrown.
  21. *
  22. * @version 1.9, 02/02/00
  23. * @author Li Gong
  24. * @author Roland Schemers
  25. */
  26. public class AccessControlException extends SecurityException {
  27. // the permission that caused the exeception to be thrown.
  28. private Permission perm;
  29. /**
  30. * Constructs an <code>AccessControlException</code> with the
  31. * specified, detailed message.
  32. *
  33. * @param s the detail message.
  34. */
  35. public AccessControlException(String s) {
  36. super(s);
  37. }
  38. /**
  39. * Constructs an <code>AccessControlException</code> with the
  40. * specified, detailed message, and the requested permission that caused
  41. * the exception.
  42. *
  43. * @param s the detail message.
  44. * @param p the permission that caused the exception.
  45. */
  46. public AccessControlException(String s, Permission p) {
  47. super(s);
  48. perm = p;
  49. }
  50. /**
  51. * Gets the Permission object associated with this exeception, or
  52. * null if there was no corresponding Permission object.
  53. *
  54. * @return the Permission object.
  55. */
  56. public Permission getPermission() {
  57. return perm;
  58. }
  59. }