B4J Question Javaobject Error in Debug Mode

swissmade

Well-Known Member
Licensed User
Hi all,

Maybe somebody has a solution for this.

This code is giving me a error when I start this in Debug Mode.
If I go Step by Step I don't get the error and the text is changed.
In Release mode there is no error and the Code is changing my TitledPane Title Text.
B4X:
Public Sub setTitledPaneText(TP As Node, Text As String )
Try
  Dim jo As JavaObject = TP
  jo.RunMethod("setText", Array As Object(Text))
Catch
    ShowLog("Error setTitledPaneText Functions", False)
End Try
End Sub
It seems that something is going to fast in Debug Mode.
Below the Sub where this is happening. Step by Step Debug and Release mode there is no problem and all is working well.
B4X:
Private Sub SetRecreation()
Try
    lstEmergencyTeam.Visible = False
    lblEmergencyTeamCount.Visible = False
    mnuVisitor.Visible = False

    btnEditVisitors.Visible = False
    EmergTitledAnchorPane.RemoveAllNodes
  
    Dim ap As AnchorPane
    ap.Initialize("")
    ap.LoadLayout("frmRecreationMenu")
    Dim img As Image
    img.Initialize(File.DirAssets, "Abo-Img.png")
    ABOImgRecreation.SetImage(img)
'    ABOImgRecreation.PreserveRatio = False
    img.Initialize(File.DirAssets, "Barcode-1.png")
    DayImgRecreation.SetImage(img)
    DayImgRecreation.PreserveRatio = False
    EmergTitledAnchorPane.AddNode(ap, -5, -5, -5, -5)
'    DayImgRecreation.Left = (ABOImgRecreation.Left + (ABOImgRecreation.Width /2) - (DayImgRecreation.Width ))
    Functions.ShowLog(Functions.GetTitledPaneText(EmergTitledPane), False)
    Functions.setTitledPaneText(EmergTitledPane, "Recreation")

'    PrecenseTitledPane.Visible = False
Catch
    Functions.ShowLog("Error Set Recreation", False)
End Try
Maybe the attached file can help.
 

Attachments

Last edited:

swissmade

Well-Known Member
Licensed User
Can you upload this project?

Where exactly does it fail?
The project is too big to upload.
SetRecreation I use in appstart after mainform.show.
I also have try to do this with a delay. like a timer or CallSubDelayed.
Its not helping.

The funny thing is, that after a regclean it happens not all the time.
If I use Step by Step debug or release mode I don't have this problem and all is working well.
 

swissmade

Well-Known Member
Licensed User
I would be happy to try to run your project.
Difficult to do there are many Add Library's and Databases needed to run.
I go to investigate something else.

I use the program Fling to make real-time backups of changes in selected directory's to my Nas.
Maybe this can be the cause. Files locked in the backup process.

I will let you know if it's the problem.
Anyhow in the meantime many thanks for your good support.
 

swissmade

Well-Known Member
Licensed User
:(Bad not helping I still get this error sometimes.
Maybe a Team-viewer session can be a option Erel??
 

swissmade

Well-Known Member
Licensed User
happen when the app starts?
Hi Erel,

Sorry for my late respond your mail was in the Spambox.
I think I have found whats happening.
If I edit at a breakpoint say insert the line Log("Your Log") and I press CTRL S the Program is missing the Row Order.
Running code from Release and not from Debug.
Sometimes the App Crashes.
If I do nothing edit after this Crash I get the startup error again.
If I edit and start the application there is no problem.
I think that this has nothing to do with the Javaobject.

This all only happens in debug mode Release mode is running very well.

See Code and Screenshot.
B4X:
Private Sub AXIOStartup()
Try
#If RELEASE
'********** Init Thread
        TRRun.Initialise("TRRun")
'**************************

    If TRRun.Running = False Then
        TRMap.Initialize()
'        TRRun.Initialise("TR")
        TRRun.Name = "AxIOStartup Thread"

    '    TRRun.Start(Me, "StartAxIOStartup_1", Array As Object(TRMap))
        TRRun.Start(Me, "StartItUp_1", Array As Object(TRMap))
    '    TRRun.Sleep(100)
    Else
        Log("AxIOStartup Thread Still Running")
    End If
#End If
#If DEBUG
    StartAxIOStartup_1(Null)
#End If
Catch
    #If RELEASE
    Log("Error Starting AxIOStartup Thread " & LastException.Message)
    #End If
End Try
End Sub
Private Sub TRRun_Ended(endedOK As Boolean, error As String) 'The thread has terminated. If endedOK is False error holds the reason for failure
   If endedOK = False Then
     Log(TRRun.Name & " Ended  " & endedOK & " " & error)
   Else
     Log(TRRun.Name & " Return OK")   
   End If   
End Sub
I hope this helps.
 

Attachments

Top