Project: AspectJ
Bug 50570 CatchClauseSignature has broken operation
Reported: 2004-01-25 11:47:31 | Status: resolved fixed

It looks like the getParameterName() operation on org.aspectj.lang.reflect. CatchClauseSignature is not working. Instead of returning the name of the exception as declared in the matched handler, returns the string value "<missing>". Here is a test case that shows the problem :- ------START OF TEST CASE CODE----------- public class MyApp { public void doSomething() { // Get around "unreachable code error... if (true) { throw new BusinessException("Surprise!!"); } System.out.println("Busy doing something."); } public static void main(String[] args) { try { MyApp m = new MyApp(); m.doSomething(); } catch (BusinessException be) { System.out.println("Exception caught : " + be.getMessage()); } } } class BusinessException extends RuntimeException { BusinessException(String message) { super(message); } } aspect AppMonitor { pointcut problemHandling() : handler(Throwable+); before() : problemHandling() { CatchClauseSignature cSig = (CatchClauseSignature) thisJoinPointStaticPart.getSignature(); System.out.println( "MONITOR::\tCaught a " + cSig.getParameterType().getName() + " called " + cSig.getParameterName()); } } ------END OF TEST CASE CODE----------- The output from running the above was ... MONITOR:: Caught a BusinessException called <missing> Exception caught : Surprise !!!! Operating system : Windows XP AspectJ : 1.1.1 final and also on latest from CVS HEAD

Files changed in fix:
tests/bugs/HandlerSig.java weaver/src/org/aspectj/weaver/Member.java weaver/src/org/aspectj/weaver/ResolvedMember.java weaver/src/org/aspectj/weaver/bcel/BcelShadow.java