[jboss-user] [Javassist Users] - how to do bytecode manipulation of j2me without having to pr

shivkumar.ms do-not-reply at jboss.com
Tue Sep 15 14:15:11 EDT 2009


Hi All, 
 I am using Javassist to modify a MIDlet class. I was successfully able to change the midlet class file and view the changes in Bytecode Viewer. 


But when i try to run the application with WTK emulator it gives me an error as follows: 

Error verifying method com/test/TestApp commandAction(Ljavax/microedition/lcdui/Command;Ljavax/microedition/lcdui/Displayable;)V 
Approximate bytecode offset 9: Inconsistent or missing stackmap at target 
Method............: 10233084 'com/sun/midp/midlet/MIDletState.createMIDlet (static)' 

I tried calling the following methods at the end to see if it fixes the problem but it didnt 
1)  methods.getMethodInfo().rebuildStackMap(classPool) on all the methods of the midlet class 
2) CtClass.rebuildClassFile() but didnt help.
 

If I run preverification on jar with the modified class files in it and then run the application in the simulator, i am able to run it. I am guessing that the preverification tool rebuilt the stackmap and hence i could run the midlet in the simulator. 


My question is there any way to modify j2me class files without having to run preverification ?






View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255367#4255367

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255367



More information about the jboss-user mailing list