1. /*
  2. * @(#)AccessControlException.java 1.13 03/12/19
  3. *
  4. * Copyright 2004 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.13, 12/19/03
  20. * @author Li Gong
  21. * @author Roland Schemers
  22. */
  23. public class AccessControlException extends SecurityException {
  24. private static final long serialVersionUID = 5138225684096988535L;
  25. // the permission that caused the exeception to be thrown.
  26. private Permission perm;
  27. /**
  28. * Constructs an <code>AccessControlException</code> with the
  29. * specified, detailed message.
  30. *
  31. * @param s the detail message.
  32. */
  33. public AccessControlException(String s) {
  34. super(s);
  35. }
  36. /**
  37. * Constructs an <code>AccessControlException</code> with the
  38. * specified, detailed message, and the requested permission that caused
  39. * the exception.
  40. *
  41. * @param s the detail message.
  42. * @param p the permission that caused the exception.
  43. */
  44. public AccessControlException(String s, Permission p) {
  45. super(s);
  46. perm = p;
  47. }
  48. /**
  49. * Gets the Permission object associated with this exeception, or
  50. * null if there was no corresponding Permission object.
  51. *
  52. * @return the Permission object.
  53. */
  54. public Permission getPermission() {
  55. return perm;
  56. }
  57. }