Android Question B4A v3.00 seems to crash DBRequestManager (RDC)

Fifi Donkor

Member
Licensed User
Longtime User
Has anybody tested b4a v3.00 with the Remote Data Connector? My previously perfectly working apps after being run through v3 are now crashing on any attempt to connect to a remote database. I have tried testing the connection from the device's browser and that works.

The log spits out "java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Float" and JobDone's Job.Success returns False.
 

Fifi Donkor

Member
Licensed User
Longtime User
I tested RDC with v3.00. Can you send me your project by mail ([email protected])?

Does it happen in all deployment modes?

Thanks for your quick response. I have not yet figured out how to change the deployment mode. I only started using v3.0 last night. Can you show me how? It is currently in rapid deployment mode, anyway.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
See this image:
SS-2013-10-14_16.29.25.png
 
Upvote 0

Fifi Donkor

Member
Licensed User
Longtime User
Yes!
That was it. It works in Release Mode.
So is it HttpUtils2 that is not compatible with RDC, as I guess?
Thanks.
 
Upvote 0

Fifi Donkor

Member
Licensed User
Longtime User
I have tried the workaround and it works so far. Are we to keep this RDC module permanently or we should revert to the earlier one once you release the "next update" to the Rapid Debugger you referred to?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I have tried the workaround and it works so far. Are we to keep this RDC module permanently or we should revert to the earlier one once you release the "next update" to the Rapid Debugger you referred to?
You can keep it permanently. It works exactly the same as the previous one.

This rapid debugger bug is a bit difficult to explain. It is related to the "Is" implementation in the debugger engine. The workaround was to create a single element array and then the "Is" check is forced to be done in the device app.
 
Upvote 0

Steve Miller

Active Member
Licensed User
Longtime User
I just downloaded and installed the RDC items and am in the process of testing my app now. I have the server up and running and it has tested fine through the browser. The first run through of my program is throwing an error in DBRequestManager. The WriteObject subroutine is throwing an error on the line that is in red text below. It is throwing a "Cannot parse: 0 as boolean" runtime error. I got around it by changing it to False instead of 0.

B4X:
Private Sub WriteObject(o As Object, out As OutputStream)
    Dim data() As Byte
    tempArray(0) = o
    If tempArray(0) = Null Then
        out.WriteBytes(Array As Byte(T_NULL), 0, 1)
    Else If tempArray(0) Is Short Then
        out.WriteBytes(Array As Byte(T_SHORT), 0, 1)
        data = bc.ShortsToBytes(Array As Short(o))
    Else If tempArray(0) Is Int Then
        out.WriteBytes(Array As Byte(T_INT), 0, 1)
        data = bc.IntsToBytes(Array As Int(o))
    Else If tempArray(0) Is Float Then
        out.WriteBytes(Array As Byte(T_FLOAT), 0, 1)
        data = bc.FloatsToBytes(Array As Float(o))
    Else If tempArray(0) Is Double Then
        out.WriteBytes(Array As Byte(T_DOUBLE), 0, 1)
        data = bc.DoublesToBytes(Array As Double(o))
    Else If tempArray(0) Is Long Then
        out.WriteBytes(Array As Byte(T_LONG), 0, 1)
        data = bc.LongsToBytes(Array As Long(o))
    Else If tempArray(0) Is Boolean Then
        out.WriteBytes(Array As Byte(T_BOOLEAN), 0, 1)
        Dim b As Boolean = 0
        Dim data(1) As Byte
        If b Then data(0) = 1 Else data(0) = 0
    Else If GetType(tempArray(0)) = "[B" Then
        data = o
        out.WriteBytes(Array As Byte(T_BLOB), 0, 1)
        WriteInt(data.Length, out)   
    Else 'If o Is String Then (treat all other values as string)
        out.WriteBytes(Array As Byte(T_STRING), 0, 1)
        data = bc.StringToBytes(o, "UTF8")
        WriteInt(data.Length, out)
    End If
    If data.Length > 0 Then out.WriteBytes(data, 0, data.Length)
End Sub
 
Upvote 0
Top