Android Question Error gone when adding break point.

walmo

Active Member
Licensed User
Longtime User
Hi
I've got a weird error.
While i was coding there was break points in my code , everything worked so i removed the break points
and then the error came .

Error occurred on line: 0
java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object;
at b4j.example.data_layout$ResumableSub_get_isp.resume(data_layout.java:459)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:368)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:182)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:94)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:135)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:84)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:94)
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 com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)

When i put a break point back again code is working.
i then add a sleep(5000) to the same place break point was , as i was loading data from jrdc server and thought maybe the
computer to fast ,data lagging. But does not help. i added about 6 more sleeps at diffrent points but nothing helps.

Add the break point and its working.

I made a jar file also, same error..
Please help
 

KMatle

Expert
Licensed User
Longtime User
Can you show the relevant code? The exception says that you trying to cast a string to an object. Correct this.

The debugger somehow catches some issues by chance via breakpoints. I noticed that before, too.
 
Upvote 0

walmo

Active Member
Licensed User
Longtime User
Hi KMatle

B4X:
Dim req As DBRequestManager = CreateRequest
 For Each item() As Object In list_isp
     Dim   mastersim As Object = item
   Dim sim_absent_day As String 'hoeveel data wat weg is dag
   Dim sim_absent_night As String ' hoeveel data weg is nag
   Dim sim_booked_day As String ' hoeveel data verkoop is dag
   Dim sim_bookee_night As String ' hoeveel data verkoop is nag
   Dim sim_used_day As String ' hoeveel data verbruik is dag
   Dim sim_used_night As String ' hoeveel data vewrbruik is nag
   Dim sim_total_data_day As String ' kontrak data op hoofsim dag
   Dim sim_total_data_night As String ' kontrak data op hoofsim nag
   
    sim_booked_day = 0
     sim_bookee_night = 0
   sim_used_day = 0
   sim_used_night = 0
   
   Dim req As DBRequestManager = CreateRequest
   Dim cmd As DBCommand = CreateCommand("device_search",Array("%%","%%","%%","%%","%"&mastersim&"%"))
   Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
   If j.Success Then
       req.HandleJobAsync(j, "req")
         Wait For (req) req_Result(res As DBResult)
   'work with result
   
         req.PrintTable(res)
   If res.Rows.Size > 0 Then
       For Each row() As Object In res.Rows
           If (row(res.Columns.Get("cutdate"))) > (DateTime.Date(DateTime.Now)) Then
               
''''''kry plan data waar op device is
            data_layout_tv_plans.SelectedRow = list_plans.IndexOf(row(res.Columns.Get("plan")))
             Dim plandag As String = (data_layout_tv_plans.SelectedRowValues(1))
            Dim plannag As String = (data_layout_tv_plans.SelectedRowValues(2))

'''''''werk uit hoeveel verkoop data oor is.
sim_booked_day = sim_booked_day + plandag
sim_bookee_night = sim_bookee_night + plannag

''''''werk uit hoeveel data oor is op device           
           Dim dayleft As Long = ((row(res.Columns.Get("cutdataday"))-row(res.Columns.Get("mtotalday")))/1000000)
           Dim nightleft As Long = ((row(res.Columns.Get("cutdatanight"))-row(res.Columns.Get("mtotalnight")))/1000000)

'''''werk used op master sim uit
sim_used_day = sim_used_day + (plandag - dayleft)
sim_used_night = sim_used_night + (plannag-nightleft)

       End If   
       Next
       
'''''werk uit data weg op master sim
sim_total_data_day = list_plan_size_day.Get(list_isp.IndexOf(mastersim))
sim_total_data_night = list_plan_size_day.Get(list_isp.IndexOf(mastersim))
sim_absent_day = sim_total_data_day - list_plan_data_day_left.Get(list_isp.IndexOf(mastersim)) - sim_used_day
sim_absent_night = sim_total_data_night - list_plan_data_night_left.Get(list_isp.IndexOf(mastersim)) - sim_used_night

   '''table view begin wys
   Dim row1() As Object = Array (mastersim,(list_sim_update_last.Get(list_isp.IndexOf(mastersim))),sim_total_data_day,sim_total_data_night,list_plan_data_day_left.Get(list_isp.IndexOf(mastersim)),list_plan_data_night_left.Get(list_isp.IndexOf(mastersim)),sim_absent_day,sim_absent_night,sim_booked_day,sim_bookee_night,sim_used_day,sim_used_night)
   data_layout_tv_sims.Items.Add(row1)
   
   End If   
    End If
       
 Next
 j.Release

Thanks
 
Upvote 0
Top