B4J Question Check destIndex and Logs not working

Elric

Well-Known Member
Licensed User
Good morning to every one!

I've a little problem.

I've a project that downloads from an online DB with 5000 rows and 7 columns.

When I open B4J and Run(F5) the project in debug mode, at first run (but just at first run) I get this error (the error is in Italian notwithstanding language is set on English - maybe refer to language system?):
B4X:
Si è verificato un errore.
Lunghezza della matrice di destinazione insufficiente. Controllare destIndex, la lunghezza e i limiti inferiori della matrice.
the translation should be:
B4X:
An error has occurred.
Insufficient target array length. Check destIndex, length, and lower bounds of the array.

After that, neither "Log" nor "Try... Catch" do not work anymore unless I reinstall B4J.

The project, anyway, works in its working parts but in this way I cannot catch where and why such subroutines doesn't work.

Any hint?

The subroutine to download the DB is the following:
B4X:
AnotherProgressBar1.Visible = True
    
    Dim myQuery As String
    myQuery = strSQLSelectAll
    Dim myJob As HttpJob
    myJob.Initialize("", Me)
    
    Dim MD5 As String
    If strPassword <> "" Then
        MD5 = MD5calc(strPassword & myQuery)
    Else
        MD5 = ""
    End If
    myJob.Download(strURL & "/execute.php?chk=" & MD5 & "&table=" & strSQLTable & "&action=" & myQuery)
    
    Wait For (myJob) JobDone(myJob As HttpJob)
    
    If myJob.Success Then
        Dim res As String
        res = myJob.GetString
        Log("Response from server: " & res)
        
        If res <> "[]" Then
            Dim parser As JSONParser
            parser.Initialize(res)

            Dim myMap As Map
            Dim myList As List
            myList.Initialize
            myMap.Initialize
            myList = parser.NextArray
            
            
            For i = 0 To myList.Size - 1
                myMap = myList.Get(i)
                lstID.Add(myMap.Get("N."))
                lstQArgument.Add(myMap.Get("Argomento"))
                lstQQuestion.Add(myMap.Get("Domanda"))
                lstQAAnswear.Add(myMap.Get("A"))
                lstQBAnswear.Add(myMap.Get("B"))
                lstQCAnswear.Add(myMap.Get("C"))
                lstQDAnswear.Add(myMap.Get("D"))
                AnotherProgressBar1.Value = (i + 1)/myList.Size*100
                Sleep(0)
            Next
            
            Private myArgumentNew As String
            Private myArgumentOld As String
            For i = 0 To lstQArgument.Size - 1
                myArgumentNew = lstQArgument.Get(i)
                If myArgumentOld <> myArgumentNew Then
                    lstGArgument.Add(myArgumentNew)
                    myArgumentOld = myArgumentNew
                End If
            Next
            cmbArguments.SetItems(lstGArgument)
            
        End If
    Else
        Log("ERROR: " & myJob.ErrorMessage)
    End If
    myJob.Release
    
    AnotherProgressBar1.Visible = False

Thanks!
 

Elric

Well-Known Member
Licensed User
I'm quite sure that the problem is not the php.

This message

1638304629655.png

appears when it arrives in line 20
B4X:
Log("Response from server: " & res)
and if I download more than 1000 rows and 7 columns. No problems with 800 rows and 7 columns.

If I delete the line, there is no error.

Nothing change with:
B4X:
Try 
                Log("Response from server: " & res)
            Catch
                Log(LastException)
            End Try

I think that the Log instruction doesn't allow string too long, because this
B4X:
Log("Response from server: " & res.SubString2(0, 999))
gives no problem.
 
Upvote 0
Top