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