2 Replies Latest reply on Nov 13, 2009 12:55 AM by bh_esozof

    Inconsistent or missing stackmap error in midlet class files

    shivurx

      Hi I am using Javassist to modify a MIDlet class. I was successfully able to change the midlet class file.

      The changes i did are as follows
      1. copied the startApp() method body to a new method and set new body for startApp().
      2. add 2 additional methods.
      3. I then called methods.getMethodInfo().rebuildStackMap(classPool) on all the methods of the midlet class
      4. called rebuildClassFile()
      5. called writeFile() to finally write the class file out to the disk.

      I could 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 have not made any changes to commandAction() method.

      I am not sure what is wrong, I would really appreciate if someone could shed some light on this.

      Thanks