realm-java: equalTo(String, boolean) -> Illegal Argument: ColumnType invalid
Goal
We’re using Realm in a library project. For synchronization, we’re using a SyncAdapter. In the synchronization process, we got a simple query with a equalTo(String, boolean)
selection to get all Persons whose flag modified_offline
is true.
Expected Results
Getting every person which is marked as modified offline.
Actual Results
In some rare cases, it crashes and throws an IllegalArgumentException: Illegal Argument: ColumnType invalid
. We got 4 crashes in the last week with a few hundred synchronizations a day. The code is executed in every synchronization.
Stack Trace:
#0. Crashed: SyncAdapterThread-34: 0 0 0x0000000000000000
at io.realm.internal.TableQuery.nativeEqual(TableQuery.java)
at io.realm.internal.TableQuery.equalTo(TableQuery.java:265)
at io.realm.RealmQuery.equalTo(RealmQuery.java:407)
at com.example.app.sync.SyncAdapter.syncPersons(PkSyncAdapter.java:164)
at com.example.app.sync.SyncAdapter.syncComplete(PkSyncAdapter.java:147)
at com.example.app.sync.SyncAdapter.onPerformSync(PkSyncAdapter.java:103)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)
--
Fatal Exception: java.lang.IllegalArgumentException: Illegal Argument: ColumnType invalid.
at io.realm.internal.TableQuery.nativeEqual(TableQuery.java)
at io.realm.internal.TableQuery.equalTo(TableQuery.java:265)
at io.realm.RealmQuery.equalTo(RealmQuery.java:407)
at com.example.app.sync.SyncAdapter.syncDongles(PkSyncAdapter.java:164)
at com.example.app.sync.SyncAdapter.syncComplete(PkSyncAdapter.java:147)
at com.example.app.sync.SyncAdapter.onPerformSync(PkSyncAdapter.java:103)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)
Steps & Code to Reproduce
Cannot reproduce it… Seems to be a fairly simple operation.
Code Sample
SyncAdapter:
@Override
public void onPerformSync(Account account, Bundle extras, String authority,
ContentProviderClient provider, SyncResult syncResult) {
Realm.init(getContext());
Realm realm = Realm.getInstance(MyApp.getRealmConfig(getContext()));
// Here's the crash:
RealmResults<Person> persons = realm.where(Person.class)
.equalTo(Person.MODIFIED_OFFLINE, true)
.findAll();
MyApp:
public static RealmConfiguration getRealmConfig(Context context) {
return new RealmConfiguration.Builder()
.name(REALM_NAME)
.modules(new MyModule())
.encryptionKey(getRealmEncryptionKey(context))
.schemaVersion(REALM_SCHEMA_VERSION)
.deleteRealmIfMigrationNeeded()
.build();
}
MyModule:
@RealmModule(library = true, allClasses = true)
public class MyModule { }
Person:
public class Person extends RealmObject {
static final String MODIFIED_OFFLINE = "modified_offline";
@PrimaryKey
private String id;
private boolean modified_offline;
...
Version of Realm and tooling
Realm version: 2.0.2
Android Studio version: 2.2.2
Which Android version and device: 6.0.1
(Samsung, Sony)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (13 by maintainers)
@MariusBoepple Please give us a status after your update.