KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > MBeanException


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
8 package javax.management;
9
10
11 /**
12  * Represents "user defined" exceptions thrown by MBean methods
13  * in the agent. It "wraps" the actual "user defined" exception thrown.
14  * This exception will be built by the MBeanServer when a call to an
15  * MBean method results in an unknown exception.
16  *
17  * @since 1.5
18  */

19 public class MBeanException extends JMException JavaDoc {
20     
21     
22     /* Serial version */
23     private static final long serialVersionUID = 4066342430588744142L;
24
25     /**
26      * @serial Encapsulated {@link Exception}
27      */

28     private java.lang.Exception JavaDoc exception ;
29    
30
31     /**
32      * Creates an <CODE>MBeanException</CODE> that wraps the actual <CODE>java.lang.Exception</CODE>.
33      *
34      * @param e the wrapped exception.
35      */

36     public MBeanException(java.lang.Exception JavaDoc e) {
37     super() ;
38     exception = e ;
39     }
40
41     /**
42      * Creates an <CODE>MBeanException</CODE> that wraps the actual <CODE>java.lang.Exception</CODE> with
43      * a detail message.
44      *
45      * @param e the wrapped exception.
46      * @param message the detail message.
47      */

48     public MBeanException(java.lang.Exception JavaDoc e, String JavaDoc message) {
49     super(message) ;
50     exception = e ;
51     }
52     
53
54     /**
55      * Return the actual {@link Exception} thrown.
56      *
57      * @return the wrapped exception.
58      */

59     public Exception JavaDoc getTargetException() {
60     return exception;
61     }
62
63     /**
64      * Return the actual {@link Exception} thrown.
65      *
66      * @return the wrapped exception.
67      */

68     public Throwable JavaDoc getCause() {
69     return exception;
70     }
71 }
72
Popular Tags