Browse Source

pr 48522

tags/mostlyLastEclipse2xTree_20040112
acolyer 20 years ago
parent
commit
14a4edf940
1 changed files with 32 additions and 0 deletions
  1. 32
    0
      tests/bugs/GetCauseOnSoftException.java

+ 32
- 0
tests/bugs/GetCauseOnSoftException.java View File

@@ -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);}
}

Loading…
Cancel
Save