]> source.dussan.org Git - aspectj.git/commitdiff
replaced Java 1.4 API
authorwisberg <wisberg>
Sat, 26 Mar 2005 21:48:27 +0000 (21:48 +0000)
committerwisberg <wisberg>
Sat, 26 Mar 2005 21:48:27 +0000 (21:48 +0000)
weaver/src/org/aspectj/weaver/BCException.java
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java

index e020d2befa7294dc1d60ed3ac369d7264951386c..d282e9d659ad66cce531190360a303ec077b830f 100644 (file)
 
 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);
+        }
+    }
 
 }
index a961821782fa084c80721e1004e2d93692a7e178..16ac151db61482e376c6d626494d79634f9c3e06 100644 (file)
@@ -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);
                }
        }