1. /*
  2. * @(#)MBeanException.java 4.20 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 javax.management;
  8. /**
  9. * Represents "user defined" exceptions thrown by MBean methods
  10. * in the agent. It "wraps" the actual "user defined" exception thrown.
  11. * This exception will be built by the MBeanServer when a call to an
  12. * MBean method results in an unknown exception.
  13. *
  14. * @since 1.5
  15. */
  16. public class MBeanException extends JMException {
  17. /* Serial version */
  18. private static final long serialVersionUID = 4066342430588744142L;
  19. /**
  20. * @serial Encapsulated {@link Exception}
  21. */
  22. private java.lang.Exception exception ;
  23. /**
  24. * Creates an <CODE>MBeanException</CODE> that wraps the actual <CODE>java.lang.Exception</CODE>.
  25. *
  26. * @param e the wrapped exception.
  27. */
  28. public MBeanException(java.lang.Exception e) {
  29. super() ;
  30. exception = e ;
  31. }
  32. /**
  33. * Creates an <CODE>MBeanException</CODE> that wraps the actual <CODE>java.lang.Exception</CODE> with
  34. * a detail message.
  35. *
  36. * @param e the wrapped exception.
  37. * @param message the detail message.
  38. */
  39. public MBeanException(java.lang.Exception e, String message) {
  40. super(message) ;
  41. exception = e ;
  42. }
  43. /**
  44. * Return the actual {@link Exception} thrown.
  45. *
  46. * @return the wrapped exception.
  47. */
  48. public Exception getTargetException() {
  49. return exception;
  50. }
  51. /**
  52. * Return the actual {@link Exception} thrown.
  53. *
  54. * @return the wrapped exception.
  55. */
  56. public Throwable getCause() {
  57. return exception;
  58. }
  59. }