I am using RDC to access the MySQL database on my server.
This works well, but if it returns a Null, I get the following error:
I have the following in Jobdone:
How can I trap this error?
I have tried inserting the following:
This works well, but if it returns a Null, I get the following error:
B4X:
Waiting for debugger to connect...
Program started.
HandleJob: 2
Results Rows: (ArrayList) []
Map: (ArrayList) []
Error occurred on line: 91 (Main)
java.lang.NullPointerException
at b4j.example.main._jobdone(main.java:304)
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.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
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)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:487)
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)
I have the following in Jobdone:
B4X:
If result.Tag = "not sent" Then
Dim ListOfMaps As List
ListOfMaps.Initialize
Log("Results Rows: " & result.Rows)
If (result.rows <> Null) Then <--------TRIED THIS
For Each row() As Object In result.Rows
ListOfMaps.Add(CreateMap("ID": row(0), "City": row(1), "Product1": row(2), "Product2": row(3), "Product3": row(4), "Product4": row(5), "Product5": row(6)))
Next
Log("Map: " & ListOfMaps)
sendTimestampSent(row(0)) <--------- Error here ((row(0)) is NULL
End If <------------------------------
End If
I have tried inserting the following:
B4X:
If (result.rows <> Null) Then
Last edited: