(unknown)

Ping Mao <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi,

I am adding trycatchfinally block in my instrumentation following the example.
The following code is my transformation used through java agent which has been
simplified to leave only the problematic instrumentation. It puts only a try
finally to the method. Instrumented class seems fine. But some jsp files in
Websphere application server 6.1, such as AppServerConfigGenPropLayout.jsp will
not be loaded successfully after instrumentation. That is, without
instrumentation, this page is loaded and initialized in websphere application
server correctly, promptly; after this simple instrumentaion, the it will block
the application server for about 70 mins and then comes up with some errors --
I guess the errors are due to the long time stuck, so servlet is not
initialized correctly. So why it blocks the application server, with CPU always
50% usage? websphere server doesn't respond for sendsignal when try to get a 
thread dump at the time. I know it is hard to try my case because it needs
websphere, but anybody has any idea that what could be wrong? Anything I can
try to resolve this issue? If it is needed, I can send along this jsp file. 

Any suggestion is highly appreciated! Thanks in advance!

public class Transformer implements ClassFileTransformer {
	public byte[] transform(ClassLoader loader, String className, Class<?>
classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws IllegalClassFormatException {
	
		ClassReader cr;
		try {
			cr = new ClassReader(classfileBuffer);
			ClassWriter cw = new ClassWriter(cr,
ClassWriter.COMPUTE_MAXS);
			try {	
				ClassVisitor classVisitor = new
ClassAdapter(cw) {
				   public MethodVisitor visitMethod(
					   final int access,
					    final String name,
					   final String desc,
					   final String signature,
					   final String[] exceptions)
				       {
					   MethodVisitor mv =
cv.visitMethod(access, name, desc, signature, exceptions);
					    return new FinallyAdapter(mv,
access, name, desc);
				       }
				};
				cr.accept(classVisitor,
ClassReader.SKIP_FRAMES);	
				
				return cw.toByteArray();

			} catch (Exception e) {
				return null;
			}			
	} catch (Exception e) {
	}
	return null;
	}
	
	class FinallyAdapter extends AdviceAdapter {
		private Label startFinally = new Label();
		protected FinallyAdapter(MethodVisitor mv, int access, String
name, String desc) {
			super(mv, access, name, desc);
		}
		public void visitCode() {			
			super.visitCode(); 
			mv.visitLabel(startFinally);
		} 
		
		public void visitMaxs(int maxStack, int maxLocals) {
			Label endFinally = new Label();
			mv.visitTryCatchBlock(startFinally, endFinally,
endFinally, null);
			mv.visitLabel(endFinally);		
			mv.visitInsn(ATHROW);
			super.visitMaxs(maxStack + 4, maxLocals);
		}
		
	}
}
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.