B4J Question httpjob ok with Debug but not in release

TomDuncan

Active Member
Licensed User
Longtime User
Hi All,
Have a program I am working on which grabs a web page and parses the values.
Work fine in debug but not release.
Any ideas..

B4X:
Sub Handle(req As ServletRequest, resp As ServletResponse)
    mreq = req
    mresp = resp
    Dim params As Map = req.ParameterMap
    Dim values() As String = params.Get("pageurl")
    For Each value As String In values
        Dim url As String = value
'        Log(url)
        Downloadcode("0",url,"temp.html")
'        Parse_Web("temp.html",url)
    Next
    resp.SendRedirect("homes.html")
End Sub


Sub Downloadcode(Id, Link As String, filename As String)
    Try
        Dim job As HttpJob
        job.Initialize("", Me) 'note that the name parameter is no longer needed.
        job.Download(Link)

        Wait For (job) JobDone(job As HttpJob)
        If job.Success Then
            Dim out As OutputStream = File.OpenOutput(File.DirApp & "/homes", filename, False)
            File.Copy2(job.GetInputStream, out)
            out.Close
'            Log("downloaded " & Id)
            Parse_Web(filename,Link)
        Else
            Log("oops " & Id)
            Dim WhereFields As Map
            WhereFields.Initialize
            WhereFields.Put("id", Id)
'            DBUtils.DeleteRecord(SQLite,"homes",WhereFields)           
        End If
        job.Release
    Catch
        Log("er: " & LastException)
    End Try
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
I don't get an error but it does not look as though the wait for is called at all.
I put a log before the wait for and it passed.
BUT nothing with success or not.
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Fixed thanks again for that Erel
"Wait For" is sometimes tricky...

What was your fix so we don't get trapped and post this same issue again? This can / often happens...

Thanks Tom.
 
Upvote 0
Top