1. /*
  2. * @(#)ReflectionException.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 exceptions thrown in the MBean server when using the
  10. * java.lang.reflect classes to invoke methods on MBeans. It "wraps" the
  11. * actual java.lang.Exception thrown.
  12. *
  13. * @since 1.5
  14. */
  15. public class ReflectionException extends JMException {
  16. /* Serial version */
  17. private static final long serialVersionUID = 9170809325636915553L;
  18. /**
  19. * @serial The wrapped {@link Exception}
  20. */
  21. private java.lang.Exception exception ;
  22. /**
  23. * Creates a <CODE>ReflectionException</CODE> that wraps the actual <CODE>java.lang.Exception</CODE>.
  24. *
  25. * @param e the wrapped exception.
  26. */
  27. public ReflectionException(java.lang.Exception e) {
  28. super() ;
  29. exception = e ;
  30. }
  31. /**
  32. * Creates a <CODE>ReflectionException</CODE> that wraps the actual <CODE>java.lang.Exception</CODE> with
  33. * a detail message.
  34. *
  35. * @param e the wrapped exception.
  36. * @param message the detail message.
  37. */
  38. public ReflectionException(java.lang.Exception e, String message) {
  39. super(message) ;
  40. exception = e ;
  41. }
  42. /**
  43. * Returns the actual {@link Exception} thrown.
  44. *
  45. * @return the wrapped {@link Exception}.
  46. */
  47. public java.lang.Exception getTargetException() {
  48. return exception ;
  49. }
  50. /**
  51. * Returns the actual {@link Exception} thrown.
  52. *
  53. * @return the wrapped {@link Exception}.
  54. */
  55. public Throwable getCause() {
  56. return exception;
  57. }
  58. }