Skip to content

Subclassing & LiveQuery #996

@mijcon

Description

@mijcon

So I'm having an issue with the Android SDK implementing LiveQuery with a subclass of ParseObject. The LiveQuery itself seems to be working properly, but ~80% of the time it throws an error when preparing to call the EventsCallback.

The error in the Logcat:

java.lang.RuntimeException: Failed to create instance of subclass.

But if you dig through the stack, it's throwing an error saying:

java.lang.IllegalStateException: ParseObject has no data for Call fetchIfNeeded() to get the data.

Full Stacktrace

To be clear, the "missing" data seems to be there 100% of the time:

V/ParseLiveQueryClient: Socket onMessage {"op":"leave","clientId":"{A_VALID_CLIENT_ID}","requestId":1,"object":{"position":{"__type":"GeoPoint","latitude":42.034534,"longitude":-93.620369},"isActive":false,"createdAt":"2020-01-10T06:28:48.955Z","updatedAt":"2020-01-11T06:47:16.739Z","timestamp":{"__type":"Date","iso":"2020-01-10T06:29:06.635Z"},"heading":45,"__type":"Object","className":"Driver","objectId":"7iBE4vmusd"},"original":{"position":{"__type":"GeoPoint","latitude":42.034534,"longitude":-93.620369},"isActive":true,"createdAt":"2020-01-10T06:28:48.955Z","updatedAt":"2020-01-11T06:42:07.567Z","timestamp":{"__type":"Date","iso":"2020-01-10T06:29:06.635Z"},"heading":45,"__type":"Object","className":"Driver","objectId":"7iBE4vmusd"}}

Anyone have any suggestions or thoughts?

What I've Tried So Far
It was originally crashing at the Boolean "isActive" with the same "ParseObject has no data for..." message, but then I switched from

ParseObject().getBoolean()

to the KTX:

ParseObject().getBooleanOrNull(key) ?: false

And it fixed it! But then I had the same issue with getDoubleOrNull(), with no such luck switching around getDouble()/getDoubleOrNull()/getNumber and casting. They all still crash.

I also disabled local datastore with no success.

Environment and Attachments
Bitnami Parse Server stack: Ubuntu 16.04 & Apache2
Parse Server 3.9.0
Parse Dashboard 2.0.5
Android SDK 1.22.1
Android LiveQuery 1.1.0

App.kt.txt
Driver.kt.txt
MainActivity.kt.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions