Re: Potential Software Failure

David Dixon-Peugh <[email protected]>
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
My original is on my work computer, but I'll crank
out a JUnit test which checks for it.  (Which can
be checked into BCEL when we are done.)

--- 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.