B4J Question Working in Debug, in Release Error [SOLVED] in Trash

MichalK73

Well-Known Member
Licensed User
Longtime User
Hello.
This is the first time I have encountered this error. In debug compilation the application is working. It compiles in Release but displays an error. The application is a simple server with one API and MqttBroker. Server can work with SSL and without it.

Error:
main._appstart (java line: 64)
java.lang.NullPointerException
    at b4j.example.main._appstart(main.java:64)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:109)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:96)
    at b4j.example.main.main(main.java:28)

Code from main.java line 64
Java:
if ((_config.Get((Object)("ssl"))).equals((Object)("0"))) {
 //BA.debugLineNum = 36;BA.debugLine="StartServer(\"srvr\", config.Get(\"port\"))";
_startserver("srvr",(int)(BA.ObjectToNumber(_config.Get((Object)("port")))));
 //BA.debugLineNum = 37;BA.debugLine="Log(\"Run server port: \"&config.Get(\"port\"))";
anywheresoftware.b4a.keywords.Common.LogImpl("365551","Run server port: "+BA.ObjectToString(_config.Get((Object)("port"))),0);
 }else {
 //BA.debugLineNum = 39;BA.debugLine="Log(\"Starting HTTPS\")";
anywheresoftware.b4a.keywords.Common.LogImpl("365553","Starting HTTPS",0);
 //BA.debugLineNum = 41;BA.debugLine="If config.Get(\"lc\")=\"1\" Then";

Which corresponds to the code in B4J

B4X:
    If config.Get("ssl") = "0" Then
        StartServer("srvr", config.Get("port"))
        Log("Run server port: "&config.Get("port"))
    Else
        Log("Starting HTTPS")

The config variable is mapped and works fine, all entries are present.
 
Last edited:

MichalK73

Well-Known Member
Licensed User
Longtime User
Oh dear, I found after an hour there was a 'sll' in the file which loads into config and it checks 'ssl'. The only strange thing is why it worked in Debug, only Release gave the error.

Post to the trash so it doesn't clutter up the site.
 
Upvote 0
Top