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