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 / RuntimeMBeanException.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-10-28  |  2.0 KB  |  76 lines

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