1 14 15 16 package org.aspectj.lang; 17 18 import java.io.PrintStream ; 19 import java.io.PrintWriter ; 20 21 31 public class SoftException extends RuntimeException { 32 33 private static final boolean HAVE_JAVA_14; 34 35 static { 36 boolean java14 = false; 37 try { 38 Class.forName("java.nio.Buffer"); 39 java14 = true; 40 } catch (Throwable t) { 41 } 43 HAVE_JAVA_14 = java14; 44 } 45 46 49 Throwable inner; 50 51 public SoftException(Throwable inner) { 52 super(); 53 this.inner = inner; 54 } 55 56 public Throwable getWrappedThrowable() { return inner; } 57 public Throwable getCause() { return inner; } 58 59 public void printStackTrace() { 60 printStackTrace(System.err); 61 } 62 63 public void printStackTrace(PrintStream stream) { 64 super.printStackTrace(stream); 65 final Throwable _inner = this.inner; 66 if (!HAVE_JAVA_14 && (null != _inner)) { 67 stream.print("Caused by: "); 68 _inner.printStackTrace(stream); 69 } 70 } 71 72 public void printStackTrace(PrintWriter stream) { 73 super.printStackTrace(stream); 74 final Throwable _inner = this.inner; 75 if (!HAVE_JAVA_14 && (null != _inner)) { 76 stream.print("Caused by: "); 77 _inner.printStackTrace(stream); 78 } 79 } 80 } 81 | Popular Tags |