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

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