Re: identifying exception exits of methods
Arrin Daley <[email protected]> Fri, 11 May 2007 14:08:56 +1000
| Newsgroups | gmane.comp.jakarta.bcel.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Hui Unless I'm missing something: If you are only after the exit points to a method you don't really need to find the end of the catch block because the catch block after it has completed will fall back to the method in which it is contained and exit via the usual return, this is provided it does not throw another exception or cause another exception to be thrown. I presume you also need to trace exit points from your method even if the exception is not caught or if a RunTimeException is caused? If so perhaps look at the interface org.apache.bcel.generic.ExceptionThrower as this interface is implemented by all bytecodes which could cause an exception to be thrown(including ATHROW and ReturnInstructions) so any instructions implementing ExceptionThrower would seem to mark the possible exits from a method. Hope this helps Bye Arrin [email protected] wrote: >Hi, > > I'm currently using BCEL to identify the exit points of a method via >a return statement, and that has worked fine. What is missing now is >identifying exit points via exception (a throw statement in a catch >block)...does anyone have any experience doing this? I read about >exception handling code and it seems like one can identify the beginning >and end of the try block and the beginning of the catch block, but I >don't see how one can identify the end of a catch block (so that I can >iterate through instructions between the start of the catch block and >the end of the catch block to find a throw instruction). Any suggestions? > > > >thanks, >Hui Nee > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [email protected] >For additional commands, e-mail: [email protected] > > > -- Conventional wisdom says to know your limits. To know your limits you need to find them first. Finding you limits generally involves getting in over your head and hoping you live long enough to benefit from the experience. That's the fun part.