jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arrin Daley <arrin.da...@anu.edu.au>
Subject Re: identifying exception exits of methods
Date Fri, 11 May 2007 04:08:56 GMT
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

hchin@cse.unl.edu wrote:

>   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?
>Hui Nee
>To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: bcel-user-help@jakarta.apache.org

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.

To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org

View raw message