Skip to content

[Bug] javascript NPE initializing a form #5774

Description

@ddyer0

Summary

This is starting boardspace as a javascript application. Very early in the setup process, before anything
exotic comes into play. Just setting up the master form; but a lot of classes are being initialized without
any explicit coordination. I see "bridge.systemfont" and "bridge.jbutton" on the stack, both being initialized.

Systemfont has some static initializers:

public class SystemFont implements Config
{
public static int defaultFontSize = Default.getInt(Default.fontsize);
private static int fontcount = 0;
private static Hashtable<Integer,Font> derivedFont = new Hashtable<Integer,Font>();
private static Hashtable<Integer,Font> uidFont = new Hashtable<Integer,Font>();
private static IdentityHashMap<Font,Integer> fontUid = new IdentityHashMap<Font,Integer>();
private static IdentityHashMap<Font,String> fontOrigin = new IdentityHashMap<Font,String>();
private static IdentityHashMap<Font,Integer> fontSize = new IdentityHashMap<Font,Integer>();
public static int PLAIN = com.codename1.ui.Font.STYLE_PLAIN;
public static int ITALIC = com.codename1.ui.Font.STYLE_ITALIC;
public static int BOLD = com.codename1.ui.Font.STYLE_BOLD;
...}

JButton doesn't have any complex static intializers, but does reference SystemFont

Here's the stack trace

port.js:3012 Exception: java.lang.NullPointerException - null
(anonymous) @ port.js:3012
parparvm_runtime.js:531 Error
at Object.newObject (parparvm_runtime.js:1194:23)
at Object.createException (parparvm_runtime.js:3434:21)
at throwNullPointerException (parparvm_runtime.js:4938:18)
at throwNullPointerException.next ()
at cn1_iv1 (parparvm_runtime.js:4386:32)
at cn1_iv1.next ()
at cn1_com_codename1_teavm_ext_localforage_LocalForage___INIT__ (translated_app.js:179872:8)
at cn1_com_codename1_teavm_ext_localforage_LocalForage___INIT__.next ()
at $Mglz (translated_app.js:179884:10)
at $Mglz.next ()
at $Mdjt (translated_app.js:93598:16)
at $Mdjt.next ()
at $Mcuf (translated_app.js:98604:16)
at $Mcuf.next ()
at $Mcid (translated_app.js:100334:12)
at next ()
at cn1_iv1 (parparvm_runtime.js:4388:44)
at cn1_iv1.next ()
at $Meul (translated_app.js:133319:13)
at $Meul.next ()
at $Mdqu (translated_app.js:93674:13)
at next ()
at cn1_iv1 (parparvm_runtime.js:4388:44)
at cn1_iv1.next ()
at $Mfxe (translated_app.js:162446:14)
at next ()
at cn1_iv1 (parparvm_runtime.js:4388:44)
at cn1_iv1.next ()
at $Mfvu (translated_app.js:161218:24)
at $Mfvu.next ()
at $Mfvw (translated_app.js:161352:12)
at $Mfvw.next ()
at $Maew (translated_app.js:31512:16)
at $Maew.next ()
at dv2 (parparvm_runtime.js:4516:44)
at dv2.next ()
at $Moxw (translated_app.js:431381:13)
at $Moxw.next ()
at cn1_bridge_SystemFont___CLINIT
(translated_app.js:33337:12)
at next ()
at Object.ensureClassInitialized (parparvm_runtime.js:1133:27)
at global._I (parparvm_runtime.js:3831:24)
at $Mjx (translated_app.js:18078:1)
at $Mjx.next ()
at cn1_bridge_JButton___INIT___java_lang_String_lib_Image_double (translated_app.js:18121:12)
at cn1_bridge_JButton___INIT___java_lang_String_lib_Image_double.next ()
at cn1_bridge_MasterPanel___INIT___bridge_MasterForm (translated_app.js:23100:8)
at cn1_bridge_MasterPanel___INIT___bridge_MasterForm.next ()
at $Mnq (translated_app.js:21339:10)
at next ()
at _dv0 (parparvm_runtime.js:4502:44)
at _dv0.next ()
at $Mnm (translated_app.js:23042:8)
at next ()
at cn1_iv0 (parparvm_runtime.js:4381:44)
at cn1_iv0.next ()
at $Made (translated_app.js:29297:8)
at $Made.next ()
at $Mop (translated_app.js:21370:10)
at $Mop.next ()
at $Mib (translated_app.js:17183:12)
at next ()
at _dv0 (parparvm_runtime.js:4502:44)
at _dv0.next ()
at $Mij (translated_app.js:17177:8)
at next ()
at cn1_iv0 (parparvm_runtime.js:4381:44)
at cn1_iv0.next ()
at cn1_bridge_Frame___INIT___java_lang_String (translated_app.js:17217:8)
at cn1_bridge_Frame___INIT___java_lang_String.next ()
at cn1_lib_TabFrame___INIT___java_lang_String (translated_app.js:530450:10)
at cn1_lib_TabFrame___INIT___java_lang_String.next ()
at cn1_lib_XFrame___INIT___java_lang_String (translated_app.js:539886:10)
at cn1_lib_XFrame___INIT___java_lang_String.next ()
at cn1_lib_TextDisplayFrame___INIT___java_lang_String (translated_app.js:535921:38)
at cn1_lib_TextDisplayFrame___INIT___java_lang_String.next ()
at $Mriz (translated_app.js:504008:10)
at next ()
at cn1_iv0 (parparvm_runtime.js:4381:44)
at cn1_iv0.next ()
at $Mkjq (translated_app.js:279073:8)
at next ()
at cn1_iv0 (parparvm_runtime.js:4381:44)
at cn1_iv0.next ()
at $Miqe (translated_app.js:233394:8)
at $Miqe.next ()
at $Miva (translated_app.js:233359:10)
at next ()
at _dv0 (parparvm_runtime.js:4502:44)
at _dv0.next ()
at $Miue (translated_app.js:232363:23)
at next ()
at _dv0 (parparvm_runtime.js:4502:44)
at _dv0.next ()
at $Mkjq (translated_app.js:279171:8)
at next ()
at cn1_iv0 (parparvm_runtime.js:4381:44)
at cn1_iv0.next ()
at $Mbxe (translated_app.js:70257:8)
at next ()
at adaptVirtualResult (parparvm_runtime.js:4359:5)
at adaptVirtualResult.next ()
at parparvm_runtime.js:5343:14
at Generator.next ()
at Object.drain (parparvm_runtime.js:2836:39)
at Object.enqueue (parparvm_runtime.js:2717:10)
at Object.resolveHostCall (parparvm_runtime.js:2439:12)
at Object.handleMessage (parparvm_runtime.js:3530:19)

Minimal reproducer

build boardspace as a javascript, load.
(easy for me to say!)

seriously, I'm interested in debugging this into existence but I don't have many javascript chops.
I may be able to produce a simpler test case with some effort, but I'm hoping you'll have an
"aha" to solve the problem without.

Steps to reproduce

just load

Expected and observed behavior

clean startup

Codename One version

current

JDK version

n/a

Target environment

javascript

Last known working version

No response

Logs and diagnostics

Screenshots or recordings

No response

Report checks

  • I searched existing issues and discussions for this behavior.
  • The reproducer contains no credentials, signing keys, or private customer data.
  • I understand that triage is not a commitment to a fix date.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions