From 8c4479ee1f75c3c336f3519eaa1c2c03719a1cbb Mon Sep 17 00:00:00 2001 From: wisberg Date: Sat, 26 Mar 2005 21:48:27 +0000 Subject: [PATCH] replaced Java 1.4 API --- .../src/org/aspectj/weaver/BCException.java | 29 ++++++++++++++++++- .../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); } } -- 2.39.5