1 31 package org.objectweb.proactive.core.mop; 32 33 public abstract class MOPRuntimeException extends RuntimeException { 34 35 protected Throwable detail; 36 37 41 public MOPRuntimeException() {} 42 43 47 public MOPRuntimeException(String s) { 48 super(s); 49 } 50 51 58 public MOPRuntimeException(String s, Throwable ex) { 59 super(s); 60 detail = ex; 61 } 62 63 69 public MOPRuntimeException(Throwable ex) { 70 super(); 71 detail = ex; 72 } 73 74 78 public String getMessage() { 79 if (detail == null) 80 return super.getMessage(); 81 else { 82 if (super.getMessage() == null) 83 return detail.getMessage(); 84 else return super.getMessage() + "; nested exception is: \n" + detail.toString(); 85 } 86 } 87 88 89 public Throwable getTargetException() { 90 return detail; 91 } 92 93 94 99 public void printStackTrace(java.io.PrintStream ps) { 100 if (detail == null) { 101 super.printStackTrace(ps); 102 } else { 103 synchronized(ps) { 104 ps.println(getMessage()); 105 detail.printStackTrace(ps); 106 } 107 } 108 } 109 110 113 public void printStackTrace() { 114 printStackTrace(System.err); 115 } 116 117 122 public void printStackTrace(java.io.PrintWriter pw) { 123 if (detail == null) { 124 super.printStackTrace(pw); 125 } else { 126 synchronized(pw) { 127 pw.println(getMessage()); 128 detail.printStackTrace(pw); 129 } 130 } 131 } 132 133 } 134 135 | Popular Tags |