Re: Re: byte code transformation checking

Eugene Kuleshov <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
  What type is "code" and how do you get it? If ClassRader can't read 
class, you won't be able to transform it, but I am certain you are 
passing an truncated bytecode. So, once again, make sure that you pass 
complete bytecode.

  Also note that you have CheckclassAdapter before your own visitor, but 
it should be after. No point to validate output of ClassReader.

  regards,
  Eugene

luc peuvrier at home wrote:
> I integrated CheckClassAdapter in my bytecode transformer as 
> preconized in CheckClassAdapter javadoc class header.
>  
> The "CheckClassAdapter./verify/(*new* ClassReader(code), *false*, 
> pw);" invokation gives:
>
>     java.lang.ArrayIndexOutOfBoundsException: 65
>     at net.sf.joafip.asm.ClassReader.readLabel(_ClassReader.java:1744_)
>     at
>     net.sf.joafip.asm.ClassReader.readFrameType(_ClassReader.java:1724_)
>     at net.sf.joafip.asm.ClassReader.accept(_ClassReader.java:1237_)
>     at net.sf.joafip.asm.ClassReader.accept(_ClassReader.java:436_)
>     at
>     net.sf.joafip.asm.util.CheckClassAdapter.verify(_CheckClassAdapter.java:207_)
>     at
>     net.sf.joafip.asm.util.CheckClassAdapter.verify(_CheckClassAdapter.java:253_)
>     at
>     net.sf.joafip.store.service.bytecode.agent.PersistableCodeGenerator.generate(_PersistableCodeGenerator.java:216_)
>     at
>     net.sf.joafip.store.service.bytecode.agent.PersistableTransformer.transform(_PersistableTransformer.java:89_)
>     at
>     net.sf.joafip.store.service.bytecode.agent.MainTransformerTest.run(_MainTransformerTest.java:77_)
>     at
>     net.sf.joafip.store.service.bytecode.agent.MainTransformerTest.main(_MainTransformerTest.java:49_)
>
> That is the same error when check the class reading bytecode in file. 
> The file is not corrupted.
>  
> I dicovered that I must set the class writer option flag with 
> "ClassWriter./COMPUTE_FRAMES/" because I add surronding try {} 
> finally{} to the mehods code.
>  
> Unfortunately, the class reader does not explicity complains about a 
> frame structure error.
>  
> Regards
> Luc
>  
> ----- Original Message -----
> From: "Eugene Kuleshov" <[email protected] <mailto:[email protected]>>
> To: <[email protected] <mailto:[email protected]>>
> Sent: Wednesday, October 13, 2010 4:58 AM
> Subject: [asm] Re: byte code transformation checking
>
> >
> >  First of all, ASM isn't designed to work with broken bytecode
> > structures. In other words, the bytecode must be readable and I suspect
> > you may have an incompletely saved file.
> >
> >  But if you are certain that file is intact, in this case it haven't
> > got to the CheckClassAdapter, because of the broken bytecode 
> structures.
> > To deal with that you need to put the CheckClassAdapter into your
> > visitors chain before the ClassWriter and make sure it passes trough.
> >
> >  regards,
> >  Eugene
> >
> >
> > luc peuvrier at home wrote:
> >> Hi,
> >> 
> >> I run CheckClassAdapter main with
> >> 
> "logs/classes/org/eclipse/jdt/internal/junit/runner/RemoteTestRunner.class" 
>
> >> as argument.
> >> And I have the here below error:
> >> 
> >>
> >>     Exception in thread "main"
> >>     _java.lang.ArrayIndexOutOfBoundsException_: 2
> >>     at
> >>     
> net.sf.joafip.asm.ClassReader.readFrameType(_ClassReader.java:1699_)
> >>     at net.sf.joafip.asm.ClassReader.accept(_ClassReader.java:1237_)
> >>     at net.sf.joafip.asm.ClassReader.accept(_ClassReader.java:436_)
> >>     at
> >>     
> net.sf.joafip.asm.util.CheckClassAdapter.verify(_CheckClassAdapter.java:207_)
> >>     at
> >>     
> net.sf.joafip.asm.util.CheckClassAdapter.verify(_CheckClassAdapter.java:253_)
> >>     at
> >>     
> net.sf.joafip.asm.util.CheckClassAdapter.main(_CheckClassAdapter.java:185_)
> >>
> >> 
> >> I expect CheckClassAdapter say to me that is wrong in RemoteTestRunner
> >> class.
> >> 
> >> Best regards
> >> Luc
> >
> >
> ------------------------------------------------------------------------
> >
> > --
> > You receive this message as a subscriber of the [email protected] 
> <mailto:[email protected]> mailing list.
> > To unsubscribe: mailto:[email protected]
> > For general help: mailto:[email protected]?subject=help
> > OW2 mailing lists service home page: http://www.ow2.org/wws
> >
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
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.