Hmmm.  I've attached a Unit test which does what
I was doing before, and the test seems to work.

I'll have to take a closer look at what I have and
see how it is different.

As for the tests, I would like to check them into
BCEL, but since we don't have any standards yet, I
would recommend we come up with some.

Any suggestions?  (Or we can just go with Maven's
suggestions.)

DDP

--- Markus Dahm <[EMAIL PROTECTED]> wrote:
> The code looks ok, it should work this way, yet
> without an
> example I can't verify. Check your back up drives
> ... ;-)
> 
> Cheers
>       Markus
> 
> David Dixon-Peugh wrote:
> 
> > 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
> 
> 
> 
> 
> --
> 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

Attachment: CodeExceptionGenTest.java
Description: CodeExceptionGenTest.java

Attachment: TInterface.java
Description: TInterface.java

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to