realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

Invalid predicate: 'desc CONTAINS[c] $0': syntax error

Open Pro-55 opened this issue 3 years ago • 3 comments

How frequently does the bug occur?

All the time

Description

The app crashes when the query is run. We have several pojos with field public String desc;.

Stacktrace & log output

Process: in.bizanalyst.debug, PID: 25439
    java.lang.IllegalArgumentException: Illegal Argument: Invalid predicate: 'desc CONTAINS[c] $0': syntax error, unexpected descending in /tmp/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_TableQuery.cpp line 512
        at io.realm.internal.TableQuery.nativeRawPredicate(Native Method)
        at io.realm.internal.TableQuery.rawPredicateWithPointers(TableQuery.java:185)
        at io.realm.RealmAnyNativeFunctionsImpl.callRawPredicate(RealmAnyNativeFunctionsImpl.java:52)
        at io.realm.internal.TableQuery.containsInsensitive(TableQuery.java:294)
        at io.realm.RealmQuery.contains(RealmQuery.java:1670)
        at io.realm.RealmQuery.contains(RealmQuery.java:1652)
        at in.bizanalyst.dao.InventoryDao.getBySubstrAndStockAvailability(InventoryDao.java:139)
        at in.bizanalyst.adapter.InventoryArrayAdapter.filterResults(InventoryArrayAdapter.java:103)
        at in.bizanalyst.adapter.InventoryArrayAdapter$InventoryFilter.publishResults(InventoryArrayAdapter.java:128)
        at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:284)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7870)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Can you reproduce the bug?

Yes, always

Reproduction Steps

Just need to trigger this query.

Version

10.11.0

What SDK flavour are you using?

Local Database only

Are you using encryption?

Yes, using encryption

Platform OS and version(s)

Android [12]

Build environment

Android Studio version: AS Chipmunk | 2021.2.1 Patch 1 Android Build Tools version: 31 Gradle version: 7.1.3

Pro-55 avatar Jul 18 '22 11:07 Pro-55

With no internet connection, same error in Realm 10.10.1 and Gradle 7.1.2, but with internet connection the error not appear 🧐

novecapa avatar Jul 19 '22 14:07 novecapa

In my case I'm just accessing the local data so its not dependant on the network state.

Pro-55 avatar Jul 20 '22 11:07 Pro-55

Hi @Pro-55. Thanks for the report. I was able to reproduce and have filed an issue in the query parser.

rorbech avatar Aug 09 '22 08:08 rorbech