1 31 package org.objectweb.proactive.core.mop; 32 33 35 public class MOPException extends Exception { 36 37 public Throwable detail; 38 39 43 public MOPException() {} 44 45 49 public MOPException(String s) { 50 super(s); 51 } 52 53 60 public MOPException(String s, Throwable ex) { 61 super(s); 62 detail = ex; 63 } 64 65 66 72 public MOPException(Throwable ex) { 73 super(); 74 detail = ex; 75 } 76 77 78 public Throwable getTargetException() { 79 return detail; 80 } 81 82 83 87 public String getMessage() { 88 if (detail == null) 89 return super.getMessage(); 90 else { 91 if (super.getMessage() == null) 92 return detail.getMessage(); 93 else return super.getMessage() + "; nested exception is: \n" + detail.toString(); 94 } 95 } 96 97 102 public void printStackTrace(java.io.PrintStream ps) { 103 if (detail == null) { 104 super.printStackTrace(ps); 105 } else { 106 synchronized(ps) { 107 ps.println(getMessage()); 108 detail.printStackTrace(ps); 109 } 110 } 111 } 112 113 116 public void printStackTrace() { 117 printStackTrace(System.err); 118 } 119 120 125 public void printStackTrace(java.io.PrintWriter pw) { 126 if (detail == null) { 127 super.printStackTrace(pw); 128 } else { 129 synchronized(pw) { 130 pw.println(getMessage()); 131 detail.printStackTrace(pw); 132 } 133 } 134 } 135 136 } 137 | Popular Tags |