1 23 24 package org.objectweb.fractal.adl; 25 26 import java.io.PrintStream ; 27 import java.io.PrintWriter ; 28 29 32 33 public class ADLException extends Exception { 34 35 38 39 private Exception exception; 40 41 47 48 public ADLException (final String msg, final Node src) { 49 super(src == null ? msg : msg + " (" + src.astGetSource() + ")"); 50 } 51 52 59 60 public ADLException (final String msg, final Node src, final Exception e) { 61 super(src == null ? msg : msg + " (" + src.astGetSource() + ")"); 62 this.exception = e; 63 } 64 65 68 69 public void printStackTrace () { 70 if (exception != null) { 71 System.err.println(this); 72 exception.printStackTrace(); 73 } else { 74 super.printStackTrace(); 75 } 76 } 77 78 83 84 public void printStackTrace (final PrintStream s) { 85 if (exception != null) { 86 s.println(this); 87 exception.printStackTrace(s); 88 } else { 89 super.printStackTrace(s); 90 } 91 } 92 93 98 99 public void printStackTrace (final PrintWriter s) { 100 if (exception != null) { 101 s.write(this + "\n"); 102 exception.printStackTrace(s); 103 } else { 104 super.printStackTrace(s); 105 } 106 } 107 } 108 | Popular Tags |