home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-tomcat-addon-1.4.9-installer.exe / jmx.jar / javax / management / MBeanException.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-10-28  |  1.9 KB  |  76 lines

  1. package javax.management;
  2.  
  3. import java.io.PrintStream;
  4. import java.io.PrintWriter;
  5.  
  6. public class MBeanException extends JMException {
  7.    private static final long serialVersionUID = 4066342430588744142L;
  8.    private Exception exception;
  9.  
  10.    public MBeanException(Exception x) {
  11.       this.exception = x;
  12.    }
  13.  
  14.    public MBeanException(Exception x, String message) {
  15.       super(message);
  16.       this.exception = x;
  17.    }
  18.  
  19.    public String getMessage() {
  20.       String msg = "";
  21.       String m1 = super.getMessage();
  22.       if (m1 != null) {
  23.          msg = msg + m1;
  24.       }
  25.  
  26.       if (this.exception != null) {
  27.          String m2 = this.exception.toString();
  28.          if (m2 != null) {
  29.             msg = msg + "nested exception is " + m2;
  30.          }
  31.       }
  32.  
  33.       return msg;
  34.    }
  35.  
  36.    public Exception getTargetException() {
  37.       return this.exception;
  38.    }
  39.  
  40.    public void printStackTrace() {
  41.       if (this.exception == null) {
  42.          super.printStackTrace();
  43.       } else {
  44.          synchronized(System.err) {
  45.             System.err.println(this);
  46.             this.exception.printStackTrace();
  47.          }
  48.       }
  49.  
  50.    }
  51.  
  52.    public void printStackTrace(PrintStream s) {
  53.       if (this.exception == null) {
  54.          super.printStackTrace(s);
  55.       } else {
  56.          synchronized(s) {
  57.             s.println(this);
  58.             this.exception.printStackTrace(s);
  59.          }
  60.       }
  61.  
  62.    }
  63.  
  64.    public void printStackTrace(PrintWriter w) {
  65.       if (this.exception == null) {
  66.          super.printStackTrace(w);
  67.       } else {
  68.          synchronized(w) {
  69.             w.println(this);
  70.             this.exception.printStackTrace(w);
  71.          }
  72.       }
  73.  
  74.    }
  75. }
  76.