Flutter plugin for the Community edition of Couchbase Lite. Couchbase Lite is an embedded lightweight, document-oriented (NoSQL), syncable database engine.
MIT License
60
stars
28
forks
source link
Crash on query with predicate using long attributes. #102
Describe the bug
Crash on query with predicate using long attributes.
Our app was making a query for a time period represented by two int64/long attributes in Unix Epoch Time, i.e milliseconds since 1970 Jan 1. However, it crashed with the following stack:
I/flutter (11304): onChange -- cubit: GlucoseQueryBloc, change: Change { currentState: GlucoseQueryLoading(), nextState: GlucoseQueryFailure: Failed to query database: Error querying Couchbase repository: CouchBaseRepositoryException: Error querying Couchbase repository: PlatformException(error, java.lang.Long cannot be cast to java.lang.Integer, null, java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
I/flutter (11304): at com.saltechsystems.couchbase_lite.QueryJson.inflateExpressionFromArray(QueryJson.java:361)
I/flutter (11304): at com.saltechsystems.couchbase_lite.QueryJson.inflateExpressionFromArray(QueryJson.java:528)
I/flutter (11304): at com.saltechsystems.couchbase_lite.QueryJson.inflateExpressionFromArray(QueryJson.java:519)
I/flutter (11304): at com.saltechsystems.couchbase_lite.QueryJson.inflateWhere(QueryJson.java:321)
I/flutter (11304): at com.saltechsystems.couchbase_lite.QueryJson.toCouchbaseQuery(QueryJson.java:114)
I/flutter (11304): at com.saltechsystems.couchbase_lite.CouchbaseLitePlugin$JSONCallHandler.onMethodCall(CouchbaseLitePlugin.java:708)
I/flutter (11304): at io.flutter.plugin.common.MethodCha
To Reproduce
Simply make a query with a long attribute in its predicate
Expected behavior
It seems that the code couldn't handle long on Android. However, it was working fine with iOS implementation.
Smartphone
Device: Pixel 2 API 29 android-x86 simulator
OS: Android 10
Additional context
According to the official document from Flutter here, a Long object is used in Java when its representation in Dart is an integer with > 32 bits.
Describe the bug Crash on query with predicate using long attributes.
Our app was making a query for a time period represented by two int64/long attributes in Unix Epoch Time, i.e milliseconds since 1970 Jan 1. However, it crashed with the following stack:
To Reproduce Simply make a query with a long attribute in its predicate
Expected behavior It seems that the code couldn't handle long on Android. However, it was working fine with iOS implementation.
Smartphone
Additional context According to the official document from Flutter here, a Long object is used in Java when its representation in Dart is an integer with > 32 bits.