diff options
author | wisberg <wisberg> | 2005-03-26 21:48:27 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2005-03-26 21:48:27 +0000 |
commit | 8c4479ee1f75c3c336f3519eaa1c2c03719a1cbb (patch) | |
tree | 0e38b1bb6b08f6335fdf8880900a76d88b347b77 /weaver | |
parent | 5ed6f1500ee1ce8110a2000cb738fa6bfae7de3c (diff) | |
download | aspectj-8c4479ee1f75c3c336f3519eaa1c2c03719a1cbb.tar.gz aspectj-8c4479ee1f75c3c336f3519eaa1c2c03719a1cbb.zip |
replaced Java 1.4 API
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/BCException.java | 29 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | 2 |
2 files changed, 29 insertions, 2 deletions
diff --git a/weaver/src/org/aspectj/weaver/BCException.java b/weaver/src/org/aspectj/weaver/BCException.java index e020d2bef..d282e9d65 100644 --- a/weaver/src/org/aspectj/weaver/BCException.java +++ b/weaver/src/org/aspectj/weaver/BCException.java @@ -13,11 +13,14 @@ 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(); } @@ -25,5 +28,29 @@ public class BCException extends RuntimeException { 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); + } + } } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java index a96182178..16ac151db 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -1525,7 +1525,7 @@ class BcelClassWeaver implements IClassWeaver { 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); } } |