1 31 package org.objectweb.proactive.core; 32 33 41 public class ProActiveRuntimeException extends RuntimeException { 42 43 protected Throwable detail; 44 45 49 public ProActiveRuntimeException() {} 50 51 55 public ProActiveRuntimeException(String s) { 56 super(s); 57 } 58 59 65 public ProActiveRuntimeException(String s, Throwable ex) { 66 super(s); 67 detail = ex; 68 } 69 70 75 public ProActiveRuntimeException(Throwable ex) { 76 super(); 77 detail = ex; 78 } 79 80 84 public String getMessage() { 85 if (detail == null) 86 return super.getMessage(); 87 else { 88 if (super.getMessage() == null) 89 return detail.getMessage(); 90 else return super.getMessage() + "; nested exception is: \n" + detail.toString(); 91 } 92 } 93 94 95 public Throwable getTargetException() { 96 return detail; 97 } 98 99 100 105 public void printStackTrace(java.io.PrintStream ps) { 106 if (detail == null) { 107 super.printStackTrace(ps); 108 } else { 109 synchronized(ps) { 110 ps.println(getMessage()); 111 detail.printStackTrace(ps); 112 } 113 } 114 } 115 116 119 public void printStackTrace() { 120 printStackTrace(System.err); 121 } 122 123 128 public void printStackTrace(java.io.PrintWriter pw) { 129 if (detail == null) { 130 super.printStackTrace(pw); 131 } else { 132 synchronized(pw) { 133 pw.println(getMessage()); 134 detail.printStackTrace(pw); 135 } 136 } 137 } 138 139 } 140 | Popular Tags |