Hello,
I have encountered an error when I switched from jHTTPUtils2 to jOKHTTPUtils2:
This happens ONLY when compiled as a LIBRARY. When I execute the code not in a Library, it works properly.
The error happens after this:
And this error cannot be caught, and seems to happen before "JobDone".
Is there something I'm missing? When I switch back to HTTPUtils2 it works.
Thank you for your help.
I have encountered an error when I switched from jHTTPUtils2 to jOKHTTPUtils2:
Waiting for debugger to connect...
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:496)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:467)
at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:541)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.BA.ra
iseEvent2(BA.java:120)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:487)
... 9 more
Caused by: java.lang.NullPointerException
at b4j.example.httputils2service._submitjob(httputils2service.java:118)
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:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
... 10 more
This happens ONLY when compiled as a LIBRARY. When I execute the code not in a Library, it works properly.
The error happens after this:
B4X:
Private Sub GetAccountDetails
Dim job As HttpJob
job.Initialize("GetAccountDetails", Me)
job.Download($"https://api.mailjet.com/v3/REST/user"$)
Auth(job)
End Sub
Private Sub Auth(Job As HttpJob)
Dim su As StringUtils
Dim userpass As String = $"${MJ_APIKEY_PUBLIC}:${MJ_APIKEY_PRIVATE}"$
Dim basicAuth As String = su.EncodeBase64(userpass.GetBytes("UTF8"))
Job.GetRequest.SetHeader("Authorization", "Basic " & basicAuth)
End Sub
Is there something I'm missing? When I switch back to HTTPUtils2 it works.
Thank you for your help.