You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by Alon Albert <al...@merc-int.com> on 2003/05/01 18:21:32 UTC

Adding Exception Handler

I am adding an exception handler to existing code. However, the MethodGen class only allows me to add the
handler to the end of the exception table.
This causes a problem since the JVM processes exceptions in order so if my exception is nested within an
existing exception, my new handler will not get called.
 
I managed to solve this by clearing the exception table (MethodGen.removeExceptionHandlers()) and then adding
my new exception before restoring the old exceptions. However, this isn't a very eficient way of doing this.
 
I can't even derive from MethodGen to solve this since the exception_vec is declared private rather than
protected.
 
Am I missing something here or is this an oversight of BCEL?