I don't have the file which has the problem here
(forgot to check it into CVS yesterday.)
The code that it generates is exactly like I said
before. (Written so as not to be confusing about
the catch block. Positions made up.)
0 ACONST_NULL
1 ICONST( 0 )
2 INVOKEVIRTUAL ( runTest(I)I )
3 ICONST( 0 )
4 IRETURN
5 ICONST( 0 )
6 IRETURN
CATCH: From 0
To 4
Handler 5
Exc java.lang.NullPointerException
The catch block is on the InstructionList, so
that isn't the problem.
The code is supposed to do the following:
Call "runTest(I)I" on NULL.
Catch the NullPointerException.
Return 0 from the handler.
It definitely throws the NPE, and it never
gets caught. (Once again, looking at the Method
that was generated, it didn't have any catch tables.)
DDP
--- Markus Dahm <[EMAIL PROTECTED]> wrote:
> David Dixon-Peugh wrote:
>
> > I have found what I believe to be a bug in BCEL,
> > and would like to see if anyone else has seen
> > this in the wild.
> >
> > Basically, I'm generating code that looks like
> this:
> > ACONST_NULL
> > ICONST( 0 )
> > INVOKEVIRTUAL ( runTest(I)I )
> > ICONST( 0 )
> > IRETURN
> > [catch NullPointerException]
> > ICONST( 0 )
> > IRETURN
> >
> > The idea is to force a NullPointerException to be
> > raised, and then catch it with a Catch clause.
> >
> > This is being done in a MethodGen object, using
> > "addExceptionHandler(...)" to create the
> > CodeExceptionGen inside the MethodGen. (Adding a
> > CodeExceptionGen is a good idea. We should be
> able
> > to do that directly.)
>
>
> Hmm. Maybe :)
>
>
> > When the MethodGen.getMethod() is called, if you
> take
> > a look at the "getExceptionTable()" result, you
> > basically get nothing. (Catch table wasn't
> written
> > to Method.)
>
>
> Where is the code of the exception handler, i.e,
> have you short example of your code.
>
> Cheers
> Markus
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>