home *** CD-ROM | disk | FTP | other *** search
- package javax.management;
-
- import java.io.PrintStream;
- import java.io.PrintWriter;
-
- public class MBeanException extends JMException {
- private static final long serialVersionUID = 4066342430588744142L;
- private Exception exception;
-
- public MBeanException(Exception x) {
- this.exception = x;
- }
-
- public MBeanException(Exception x, String message) {
- super(message);
- this.exception = x;
- }
-
- public String getMessage() {
- String msg = "";
- String m1 = super.getMessage();
- if (m1 != null) {
- msg = msg + m1;
- }
-
- if (this.exception != null) {
- String m2 = this.exception.toString();
- if (m2 != null) {
- msg = msg + "nested exception is " + m2;
- }
- }
-
- return msg;
- }
-
- public Exception getTargetException() {
- return this.exception;
- }
-
- public void printStackTrace() {
- if (this.exception == null) {
- super.printStackTrace();
- } else {
- synchronized(System.err) {
- System.err.println(this);
- this.exception.printStackTrace();
- }
- }
-
- }
-
- public void printStackTrace(PrintStream s) {
- if (this.exception == null) {
- super.printStackTrace(s);
- } else {
- synchronized(s) {
- s.println(this);
- this.exception.printStackTrace(s);
- }
- }
-
- }
-
- public void printStackTrace(PrintWriter w) {
- if (this.exception == null) {
- super.printStackTrace(w);
- } else {
- synchronized(w) {
- w.println(this);
- this.exception.printStackTrace(w);
- }
- }
-
- }
- }
-