mozilla / pluotsorbet

[ARCHIVED] PluotSorbet is a J2ME-compatible virtual machine written in JavaScript.
GNU General Public License v2.0
237 stars 46 forks source link

"java.lang.NullPointerException: object is null" in DisplayEventConsumerImpl.handleVirtualKeyboardEvent #1179

Open mykmelez opened 9 years ago

mykmelez commented 9 years ago

I sometimes see "java.lang.NullPointerException: object is null" in DisplayEventConsumerImpl.handleVirtualKeyboardEvent when using a midlet on device, although I'm unsure exactly what triggers it:

java.lang.NullPointerException: object is null

  • java/lang/RuntimeException.(), bci=0
  • java/lang/NullPointerException.(), bci=0
  • javax/microedition/lcdui/Display$DisplayEventConsumerImpl.handleVirtualKeyboardEvent(), bci=0
  • com/sun/midp/events/EventQueue.run(), bci=0
  • java/lang/Thread.run(), bci=0
  • java/lang/Thread.ThreadStart0Synthetic(), bci=0
  • javax/microedition/lcdui/Display$DisplayEventConsumerImpl.handleVirtualKeyboardEvent(), bci=32
  • com/sun/midp/events/EventQueue.run(), bci=132

It seems related to text editor fields that cause the virtual keyboard to appear, and it have something to do with tapping the Home button to return to the homescreen while the keyboard is visible.

mykmelez commented 9 years ago

The other place where I see a similar error, which I suspect has the same cause, is in Display.getDisplay, on startup, when _DEBUG_PRINT_ALLEXCEPTIONS is enabled:

"java/lang/NullPointerException: object is null

  • java/lang/RuntimeException.(Ljava/lang/String;)V, pc=undefined
  • java/lang/NullPointerException.(Ljava/lang/String;)V, pc=undefined
  • javax/microedition/lcdui/Display.getDisplay(Ljava/lang/Object;)Ljavax/microedition/lcdui/Display;, pc=undefined
  • javax/microedition/lcdui/Display.getDisplay(Ljavax/microedition/midlet/MIDlet;)Ljavax/microedition/lcdui/Display;, pc=undefined
  • com/sun/midp/lcdui/DisplayEventHandlerFactory.getDisplayEventHandler(Lcom/sun/midp/security/SecurityToken;)Lcom/sun/midp/lcdui/DisplayEventHandler;, pc=undefined
  • com/sun/midp/lcdui/LCDUIEnvironment.(Lcom/sun/midp/security/SecurityToken;Lcom/sun/midp/events/EventQueue;ILcom/sun/midp/lcdui/ForegroundController;)V, pc=undefined
  • com/sun/midp/main/CldcMIDletSuiteLoader.createSuiteEnvironment()V, pc=undefined
  • com/sun/midp/main/MIDletSuiteLoader.createSuiteEnvironment()V, pc=undefined
  • com/sun/midp/main/CldcMIDletSuiteLoader.runMIDletSuite()V, pc=undefined
  • com/sun/midp/main/MIDletSuiteLoader.main([Ljava/lang/String;)V, pc=undefined
  • javax/microedition/lcdui/Display.getDisplay(Ljava/lang/Object;)Ljavax/microedition/lcdui/Display;, pc=9
  • javax/microedition/lcdui/Display.getDisplay(Ljavax/microedition/midlet/MIDlet;)Ljavax/microedition/lcdui/Display;, pc=4
  • com/sun/midp/lcdui/DisplayEventHandlerFactory.getDisplayEventHandler(Lcom/sun/midp/security/SecurityToken;)Lcom/sun/midp/lcdui/DisplayEventHandler;, pc=19
marco-c commented 9 years ago

The NullPointerException in getDisplay is expected: https://github.com/mozilla/j2me.js/blob/6a72486408186172eca0d40bfac15e200a2fdfa3/java/midp/com/sun/midp/lcdui/DisplayEventHandlerFactory.java#L82

mykmelez commented 9 years ago

Ugh. I suppose it isn't worth a custom just to fix that, although it's distracting. Perhaps the other exception is similarly intentional.