package org.aspectj.weaver;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
/**
* Exception to use inside the bcweaver.
*/
public class BCException extends RuntimeException {
-
+ Throwable thrown;
public BCException() {
super();
}
public BCException(String s) {
super(s);
}
+ public BCException(String s, Throwable thrown) {
+ super(s);
+ this.thrown = thrown;
+ }
+ public void printStackTrace() {
+ printStackTrace(System.err);
+ }
+ public void printStackTrace(PrintStream s) {
+ printStackTrace(new PrintWriter(s));
+ }
+ public void printStackTrace(PrintWriter s) {
+ super.printStackTrace(s);
+ if (null != thrown) {
+ s.print("Caused by: ");
+ s.print(thrown.getClass().getName());
+ String message = thrown.getMessage();
+ if (null != message) {
+ s.print(": ");
+ s.print(message);
+ }
+ s.println();
+ thrown.printStackTrace(s);
+ }
+ }
}
rm.setAnnotationTypes(annotations);
} catch (Throwable t) {
//FIXME asc remove this catch after more testing has confirmed the above stuff is OK
- throw new RuntimeException("Unexpectedly went bang when searching for annotations on "+rm,t);
+ throw new BCException("Unexpectedly went bang when searching for annotations on "+rm,t);
}
}