1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

B4J Question Strange Compile Error in Release Mode

Discussion in 'B4J Questions' started by mauro vicamini, Jul 31, 2019.

  1. mauro vicamini

    mauro vicamini Active Member Licensed User

    Hi Evryone,
    I don't why when I compile in debug mode all goes ok, but when I compile in release mode I get this error
    Code:
    B4J Versione: 7.31
    Java Versione: 
    8
    Analisi del Codice.    (
    0.06s)
    Building folders structure.    (
    0.02s)
    Compilazione del codice.    Error
    Errore nella compilazione del programma.
    Descrizione dell
    'errore: ',' atteso.
    Errore nella linea: 61
    initialize(rdclink)
    Word
    The source code involved is this class:
    Code:
    Sub Class_Globals
        
    Private rdclink As String
        
    Private fx As JFX
        
    Dim id As  String = Null
        
    Dim nome As   String = ""
        
    Dim ubicazione As   String = ""
        
    Dim t_uuid As   String = ""
    End Sub


    Public Sub setId(vid As String)
        
    id = vid
    End Sub
    Public Sub setNome(vnome As  String)
        nome = vnome
    End Sub
    Public Sub setUbicazione(vubicazione As  String)
        ubicazione = vubicazione
    End Sub
    Public Sub setT_uuid(vt_uuid As  String)
        t_uuid = vt_uuid
    End Sub
    public Sub loadByResultset(res As DBResult)
        
    For Each Row() As Object In res.Rows
     
            
    id =  Row(res.Columns.Get("id"))
            nome =  Row(res.Columns.Get(
    "nome"))
            ubicazione =  Row(res.Columns.Get(
    "ubicazione"))
            t_uuid =  Row(res.Columns.Get(
    "t_uuid"))
        
    Next
    End Sub
    public Sub initialize(rdcUri As String)
        rdclink = rdcUri
     
        
    id = Null
        nome = 
    ""
        ubicazione = 
    ""
        t_uuid = 
    ""
    End Sub

    Public Sub getId As String
        
    Return id
    End Sub
    Public Sub getNome As  String
        
    Return nome
    End Sub
    Public Sub getUbicazione As  String
        
    Return ubicazione
    End Sub
    Public Sub getT_uuid As  String
        
    Return t_uuid
    End Sub

    Public Sub getPostazioniById(vId As Object) As ResumableSub
        
    Dim res As DBResult = Null
        jRDC2Utils.Intitialize(rdclink)
        
    Wait For (jRDC2Utils.ExecuteQuery(jRDC2Utils.CreateCommand("select_postazioni_byId"Array(vId)))) complete (res As DBResult)
        
    If Not(res = NullThen
            loadByResultset(res)
        
    Else
            initialize(rdclink) 
    ' ******** THIS IS THE LINE 61 OF THE COMPILE ERROR
        End If
    End Sub
    Public Sub getListaPostazioni() As ResumableSub
        
    Dim res As DBResult = Null
        jRDC2Utils.Intitialize(rdclink)
        
    Wait For (jRDC2Utils.ExecuteQuery(jRDC2Utils.CreateCommand("select_lista_postazioni"Array()))) complete (res As DBResult)
        
    If Not(res = NullThen
            
    Return res
        
    Else
            
    Return res
        
    End If
    End Sub
    public Sub delete() As ResumableSub
        jRDC2Utils.Intitialize(rdclink)
        
    Wait For (jRDC2Utils.ExecuteCommands(Array (jRDC2Utils.CreateCommand("delete_postazioni"Array(id))))) complete (count As Int)
    End Sub
    Public Sub insert() As ResumableSub
        jRDC2Utils.Intitialize(rdclink)
        t_uuid = jRDC2Utils.generateUUID()
        
    Wait For (jRDC2Utils.ExecuteCommands(Array (jRDC2Utils.CreateCommand("insert_postazioni"Array(nome,ubicazione,t_uuid))))) complete (count As Int)
    End Sub
    Public Sub update() As ResumableSub
        jRDC2Utils.Intitialize(rdclink)
        
    Wait For (jRDC2Utils.ExecuteCommands(Array (jRDC2Utils.CreateCommand("update_postazioni"Array(nome,ubicazione,t_uuid,id))))) complete (count As Int)
    End Sub
    private Sub retriveID() As ResumableSub
        
    Dim res As DBResult = Null
        jRDC2Utils.Intitialize(rdclink)
        
    Wait For (jRDC2Utils.ExecuteQuery(jRDC2Utils.CreateCommand("retriveid_postazioni"Array(t_uuid)))) complete (res As DBResult)
        
    If Not(res = NullThen
            
    id = jRDC2Utils.GetColumnObject(res,0,"id")
        
    Else
            
    id = Null
        
    End If
    End Sub
    Public Sub save() As ResumableSub
        
    If (id = Null or id.EqualsIgnoreCase("Null")) Then
            
    wait for (insert) complete()
            
    wait for (retriveID) complete()
        
    Else
            
    wait for (update) complete()
        
    End If
    End Sub
    The strange thing is that if I change the name of the method "initialize" (also in all the parts where is called) with whatever else name (i.e.: kinitialize) it works. It seams that "initialize" is like a some kind of reserved word. I could change the name but I've tons of classes with the same method and all have the same problems.
    Pls help me.

    Thanks for the attention.
     
    Last edited: Jul 31, 2019
  2. Erel

    Erel Administrator Staff Member Licensed User

    Initialize is indeed a special sub. It is similar to a constructor. You shouldn't call it except of when you create the object.

    BTW, it is a mistake to set variables to Null, especially string variables.
     
    mauro vicamini likes this.
  3. mauro vicamini

    mauro vicamini Active Member Licensed User

    Thanks Erel,
    So I imagine to do a change like this:
    Code:
    public Sub initialize(rdcUri As String)
        rdclink = rdcUri
        init

    End Sub
    private sub init()
        
    id = ""
        nome = 
    ""
        ubicazione = 
    ""
        t_uuid = 
    ""
    end sub
    ....
    Public Sub getPostazioniById(vId As Object) As ResumableSub
        
    Dim res As DBResult = Null
        jRDC2Utils.Intitialize(rdclink)
        
    Wait For (jRDC2Utils.ExecuteQuery(jRDC2Utils.CreateCommand("select_postazioni_byId"Array(vId)))) complete (res As DBResult)
        
    If Not(res = NullThen
            loadByResultset(res)
        
    Else
            init
        
    End If
    End Sub
     
    Erel likes this.
  4. mauro vicamini

    mauro vicamini Active Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice