]> source.dussan.org Git - aspectj.git/commitdiff
pr 48522
authoracolyer <acolyer>
Wed, 7 Jan 2004 16:41:51 +0000 (16:41 +0000)
committeracolyer <acolyer>
Wed, 7 Jan 2004 16:41:51 +0000 (16:41 +0000)
tests/bugs/GetCauseOnSoftException.java [new file with mode: 0644]

diff --git a/tests/bugs/GetCauseOnSoftException.java b/tests/bugs/GetCauseOnSoftException.java
new file mode 100644 (file)
index 0000000..125fce8
--- /dev/null
@@ -0,0 +1,32 @@
+
+import org.aspectj.lang.*;
+
+public class GetCauseOnSoftException {
+
+       public static void a(){
+               b();
+       }
+       /**
+        * Method b.
+        */
+       private static void b() {
+               throw new MyException("secret");
+       }
+    
+       public static void main(String[] args) {
+               try {
+                       a();
+               } catch (SoftException e) {
+                       System.out.println(e.getCause());
+                       if (e.getCause().getMessage().indexOf("secret")==-1) 
+                         throw new RuntimeException("Didn't get expected cause of SoftException");
+               }
+       }
+}
+aspect Softner {
+               declare soft : MyException : within(GetCauseOnSoftException);  
+}
+
+class MyException extends Exception {
+       MyException(String s) { super(s);}
+}
\ No newline at end of file