Bug? Try / Catch not working

mrred128

Active Member
Licensed User
Longtime User
With the following code in a web module......

B4X:
    resp.ContentType = "text/text;charset=UTF-8"
    Try
        ' read in the input
        Dim bc As ByteConverter
        Dim iJSon As JSONParser
        Dim InS As InputStream = req.InputStream
        Dim Buffer(ins.BytesAvailable) As Byte
        InS.ReadBytes(Buffer,0,Buffer.Length)
        iJSon.Initialize(Stuff.rc4(bc.StringFromBytes(Buffer,"utf-8"),Stuff.DefKey))
        Dim iparam As List = ijson.NextArray
        ' do something
        Log(iparam)
        ' set the output
        Dim oJSon As JSONGenerator
        Dim Data As List
        Dim str As String = "THIS IS A TEST"
        Data.Initialize
        Data.Add(str)
        oJSon.Initialize2(Data)
        resp.write(Stuff.RC4(oJSon.ToString,Stuff.DefKey))
    Catch
        resp.SendError(500,"OPPS")
    End Try


So, this code takes a rc4 json string and does nothing and spits out a rc4 json string. When nothing has been sent to the page, it should send a 500 error code, but just crashes on the 'Dim iparam As List = ijson.NextArray' line.
 

mrred128

Active Member
Licensed User
Longtime User
Running it in release mode does make it work as it should. However in debug mode, it displays the crash dump in the log and does not send the 500 code. It does not accept any new requests.
 
Top