1. /*
  2. * @(#)JMRuntimeException.java 4.18 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. * Runtime exceptions emitted by JMX implementations.
  10. *
  11. * @since 1.5
  12. */
  13. public class JMRuntimeException extends RuntimeException {
  14. /* Serial version */
  15. private static final long serialVersionUID = 6573344628407841861L;
  16. /**
  17. * Default constructor.
  18. */
  19. public JMRuntimeException() {
  20. super();
  21. }
  22. /**
  23. * Constructor that allows a specific error message to be specified.
  24. *
  25. * @param message the detail message.
  26. */
  27. public JMRuntimeException(String message) {
  28. super(message);
  29. }
  30. /**
  31. * Constructor with a nested exception. This constructor is
  32. * package-private because it arrived too late for the JMX 1.2
  33. * specification. A later version may make it public.
  34. */
  35. JMRuntimeException(String message, Throwable cause) {
  36. super(message);
  37. /* Make a best effort to set the cause, but if we don't
  38. succeed, too bad, you don't get that useful debugging
  39. information. We jump through hoops here so that we can
  40. work on platforms prior to J2SE 1.4 where the
  41. Throwable.initCause method was introduced. If we change
  42. the public interface of JMRuntimeException in a future
  43. version we can add getCause() so we don't need to do this. */
  44. try {
  45. java.lang.reflect.Method initCause =
  46. Throwable.class.getMethod("initCause",
  47. new Class[] {Throwable.class});
  48. initCause.invoke(this, new Object[] {cause});
  49. } catch (Exception e) {
  50. // OK: just means we won't have debugging info
  51. }
  52. }
  53. }