1 28 29 package com.caucho.ejb.burlap; 30 31 import java.io.PrintStream ; 32 import java.io.PrintWriter ; 33 import java.rmi.RemoteException ; 34 35 public class SerializedExceptionWrapper extends RemoteException { 36 private Throwable cause; 37 private String trace; 38 39 public SerializedExceptionWrapper() {} 40 41 public SerializedExceptionWrapper(Throwable cause, String trace) 42 { 43 this.cause = cause; 44 this.trace = trace; 45 } 46 47 public Throwable getRootCause() 48 { 49 return cause; 50 } 51 52 public String getMessage() 53 { 54 return "remote: " + cause.getMessage(); 55 } 56 57 public String toString() 58 { 59 return "SerializedExceptionWrapper: " + cause.toString(); 60 } 61 62 public void printStackTrace() 63 { 64 if (trace != null) { 65 System.out.print("remote exception: "); 66 System.out.print(trace); 67 } 68 69 System.out.print("local exception: "); 70 super.printStackTrace(); 71 } 72 73 public void printStackTrace(PrintWriter pw) 74 { 75 if (trace != null) { 76 pw.print("remote exception: "); 77 pw.print(trace); 78 } 79 80 pw.print("local exception: "); 81 super.printStackTrace(pw); 82 } 83 84 public void printStackTrace(PrintStream os) 85 { 86 if (trace != null) { 87 os.print("remote exception: "); 88 os.print(trace); 89 } 90 91 os.print("local exception: "); 92 super.printStackTrace(os); 93 } 94 } 95 | Popular Tags |