IllegalStateException: Try catch blocks must be visited before their labels

Rajaraman Santhanam <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <12dcd720f71.-4820928500942468972.1718048482141829991@zohocorp.com>
Hi,

I get this exception if I put CheckClassAdapter in the visitors chain before ClassWriter. The code I use is below:
ClassReader reader = new ClassReader(classfileBuffer);
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS);


BasicClassAdapter adapter =  new BasicClassAdapter(new CheckClassAdapter(writer), className, classBeingRedefined);
reader.accept(adapter, ClassReader.SKIP_DEBUG); 

By running this I get error with details:
java.lang.IllegalStateException: Try catch blocks must be visited before their labels
        at org.objectweb.asm.util.CheckMethodAdapter.visitTryCatchBlock(CheckMethodAdapter.java:679)
        at org.objectweb.asm.MethodAdapter.visitTryCatchBlock(MethodAdapter.java:170)
        at test.agent.instrumentation.BasicMethodAdapter.visitMaxs(BasicMethodAdapter.java:86) 

However my instrumentation code work perfectly well if run this without CheckClassAdapter. Not sure what I'm missing here. 


I tried this when seeing the mail from Eugene to use CheckClassAdapter to catch various issues. 


My BasicClassAdapter is the implementation of FinallyAdapter from asm-transformations.pdf


Can somebody help me out here? 


Regards,
Rajaraman
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.