1 17 package org.eclipse.emf.common.util; 18 19 import java.io.PrintStream ; 20 import java.io.PrintWriter ; 21 22 23 26 public class WrappedException extends RuntimeException 27 { 28 31 protected Exception wrappedException; 32 33 36 public WrappedException(Exception exception) 37 { 38 super(exception.getLocalizedMessage()); 39 wrappedException = exception; 40 } 41 42 47 public WrappedException(String message, Exception exception) 48 { 49 super(message); 50 wrappedException = exception; 51 } 52 53 57 public Exception exception() 58 { 59 return wrappedException; 60 } 61 62 65 public void printStackTrace() 66 { 67 System.err.println("Wrapped exception"); 68 wrappedException.printStackTrace(); 69 System.err.println("Wrapped by"); 70 super.printStackTrace(); 71 } 72 73 77 public void printStackTrace(PrintStream printStream) 78 { 79 printStream.println("Wrapped exception"); 80 wrappedException.printStackTrace(printStream); 81 printStream.println("Wrapped by"); 82 super.printStackTrace(printStream); 83 } 84 85 89 public void printStackTrace(PrintWriter printWriter) 90 { 91 printWriter.println("Wrapped exception"); 92 wrappedException.printStackTrace(printWriter); 93 printWriter.println("Wrapped by"); 94 super.printStackTrace(printWriter); 95 } 96 } 97 | Popular Tags |