ALERT: java/lang/ClassFormatError: Bad stack map.
Hello friends.
I need help. SOS.
Where is wrong in this code?
Problem is in comparision.
Comenting this lines, all are ok.
if(time1==time2)
System.out.println("Equal");
else
System.out.println("Different");
C骴igo del Midlet:
package borrame.pruebas;
import java.util.Date;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
publicclass Pruebaextends MIDletimplements CommandListener{
Display display;
Form mainForm;
// Comandos para salir y volver a la pantalla principal.
Command cmdSalir;
public Prueba(){
super();
mainForm =new Form ("HelloMidp");
cmdSalir =new Command("Salir", Command.EXIT,1);
mainForm.addCommand(cmdSalir);
mainForm.setCommandListener(this);
}
protectedvoid startApp()throws MIDletStateChangeException{
display = Display.getDisplay(this);
display.setCurrent (mainForm);
long time1 =new Date().getTime();
long time2 =new Date().getTime() +100;
System.out.println("time1: " + time1);
System.out.println("time2: " + time2);
System.out.println("time1 + time2 =" + (time1 + time2));
if(time1==time2)
System.out.println("Equal");
else
System.out.println("Different");
}
protectedvoid pauseApp(){
// TODO Auto-generated method stub
}
protectedvoid destroyApp(boolean arg0)throws MIDletStateChangeException{
// TODO Auto-generated method stub
}
publicvoid commandAction(Command c, Displayable d){
if (c == cmdSalir){// Selecciono salir de la aplicacion
try{
destroyApp(false);
}catch (MIDletStateChangeException e){
e.printStackTrace();
}
notifyDestroyed();
}
}
}
Output console:
Warning: Cannot convert string"-b&h-lucida-medium-r-normal-sans-*-140-*-*-p-*-iso8859-1" to type FontStruct
Running with storage root DefaultColorPhone
ALERT: java/lang/ClassFormatError: Bad stack map.
Method............: b7d29990'com/sun/midp/midlet/MIDletState.createMIDlet (static)'
Stack Chunk.......: b783d300
Frame Pointer.....: b783d3a4
Current IP........: b7da5669 = b7da565b + offset 14
Previous Frame....: b783d36c
Previous IP.......: b7d87f44 (offset 52)
Frame size........: 7 (1 arguments, 6 local variables)
Argument[0].......: b783cad0
Local[1]..........: b78b35c8
Local[2]..........: b7d87f41
Local[3]..........: b783cc38
Local[4]..........: b7d29788
Local[5]..........: b78b355c
Local[6]..........: 0
Operand[1]........: b783cad0
Method............: b7d16390'com/sun/midp/midlet/Scheduler.schedule (virtual)'
Stack Chunk.......: b783d300
Frame Pointer.....: b783d36c
Current IP........: b7d87f44 = b7d87f10 + offset 52
Previous Frame....: b783d338
Previous IP.......: b7d92b05 (offset 28)
Frame size........: 7 (2 arguments, 5 local variables)
Argument[0].......: b783cd14
Argument[1].......: b783c460
Local[2]..........: b78b20c4
Local[3]..........: b78b3594
Local[4]..........: b7d92b01
Local[5]..........: b78b35a8
Local[6]..........: b7d162b0
Operand[1]........: b783cd14
Method............: b7d1e084'com/sun/midp/main/Main.runLocalClass (static)'
Stack Chunk.......: b783d300
Frame Pointer.....: b783d338
Current IP........: b7d92b05 = b7d92ae9 + offset 28
Previous Frame....: b783d314
Previous IP.......: b7d9257c (offset 116)
Frame size........: 3 (1 arguments, 2 local variables)
Argument[0].......: b783d1bc
Local[1]..........: b783c460
Local[2]..........: b78b3570
Method............: b7d1dfe4'com/sun/midp/main/Main.main (static)'
Stack Chunk.......: b783d300
Frame Pointer.....: b783d314
Current IP........: b7d9257c = b7d92508 + offset 116
Previous Frame....: 0
Previous IP.......: 1
Frame size........: 3 (1 arguments, 2 local variables)
Argument[0].......: b783d5ec
Local[1]..........: b783d1bc
Local[2]..........: b783cb24
VM status:
Instruction pointer.: b7da5669 (offset within invoking method: 14)
Next instruction....: 0x4c
Frame pointer.......: b783d3a4
Local pointer.......: b783d388
Stack size..........: 128; sp: b783d3bc; ranges: b783d308-b783d508;
Contents of the current stack frame:
b783d388: b783cad0 (lp)
b783d38c: b78b35c8
b783d390: b7d87f41
b783d394: b783cc38
b783d398: b7d29788
b783d39c: b78b355c
b783d3a0: 0
b783d3a4: b783d36c (fp)
b783d3a8: b7d87f44
b783d3ac: b783d384
b783d3b0: b7d29990
b783d3b4: b783d300
b783d3b8: 0 (end of frame)
b783d3bc: b783cad0 (sp)
Execution stack contains 184 items:
b783d5ec
b783d1bc
b783cb24
0
1
b78b3560
b7d1dfe4
b783d300
0
b783d1bc
b783c460
b78b3570
b783d314
b7d9257c
b783d328
b7d1e084
b783d300
0
b783cd14
b783c460
b78b20c4
b78b3594
b7d92b01
b78b35a8
b7d162b0
b783d338
b7d92b05
b783d34c
b7d16390
b783d300
0
b783cd14
b783cad0
b78b35c8
b7d87f41
b783cc38
b7d29788
b78b355c
0
b783d36c
b7d87f44
b783d384
b7d29990
b783d300
0
b783cad0
Execution completed.
717374 bytecodes executed
5 thread switches
742 classes in the system (including system classes)
3720 dynamic objects allocated (102340 bytes)
2 garbage collections (88196 bytes collected)
Execution completed.
717374 bytecodes executed
5 thread switches
742 classes in the system (including system classes)
3720 dynamic objects allocated (102340 bytes)
2 garbage collections (88196 bytes collected)

