01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.org
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package javax.management;
09:
10: /**
11: * Runtime exceptions emitted by JMX implementations.
12: *
13: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
14: */
15:
16: public class JMRuntimeException extends RuntimeException {
17:
18: /**
19: * Default constructor.
20: */
21: public JMRuntimeException() {
22: super ();
23: }
24:
25: /**
26: * Constructor that allows a specific error message to be specified.
27: */
28: public JMRuntimeException(String message) {
29: super (message);
30: }
31:
32: /**
33: * Constructor with a nested exception. This constructor is
34: * package-private because it arrived too late for the JMX 1.2
35: * specification. A later version may make it public.
36: */
37: JMRuntimeException(String message, Throwable cause) {
38: super (message);
39:
40: /* Make a best effort to set the cause, but if we don't
41: succeed, too bad, you don't get that useful debugging
42: information. We jump through hoops here so that we can
43: work on platforms prior to J2SE 1.4 where the
44: Throwable.initCause method was introduced. If we change
45: the public interface of JMRuntimeException in a future
46: version we can add getCause() so we don't need to do this.
47: */
48: try {
49: java.lang.reflect.Method initCause = Throwable.class
50: .getMethod("initCause",
51: new Class[] { Throwable.class });
52: initCause.invoke(this , new Object[] { cause });
53: } catch (Exception e) {
54: // too bad, no debugging info
55: }
56: }
57:
58: }
|