1 28 29 package com.caucho.util; 30 31 import java.io.PrintStream ; 32 import java.io.PrintWriter ; 33 34 37 public class NotImplementedException extends UnsupportedOperationException 38 implements ExceptionWrapper { 39 private Throwable rootCause; 40 41 public NotImplementedException(String message) 42 { 43 super(message); 44 } 45 46 public NotImplementedException(String message, Throwable e) 47 { 48 super(message); 49 50 rootCause = e; 51 } 52 53 public NotImplementedException(Throwable e) 54 { 55 super(e.toString()); 56 57 rootCause = e; 58 } 59 60 public static UnsupportedOperationException create(Exception e) 61 { 62 if (e instanceof UnsupportedOperationException ) 63 return (UnsupportedOperationException ) e; 64 else 65 return new NotImplementedException(e); 66 } 67 68 public Throwable getRootCause() 69 { 70 return rootCause; 71 } 72 73 76 public void printStackTrace(PrintWriter out) 77 { 78 super.printStackTrace(out); 79 80 Throwable rootCause = getRootCause(); 81 82 if (rootCause != null) { 83 out.println("Root cause is:"); 84 rootCause.printStackTrace(out); 85 } 86 } 87 88 91 public void printStackTrace(PrintStream out) 92 { 93 super.printStackTrace(out); 94 95 Throwable rootCause = getRootCause(); 96 97 if (rootCause != null) { 98 out.println("Root cause is:"); 99 rootCause.printStackTrace(out); 100 } 101 } 102 } 103 | Popular Tags |