-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash when negating query with empty group #7234
base: releases
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments on how the tests are written + we do need a changelog entry for it.
RealmResults<AllTypes> fives = realm.where(AllTypes.class) | ||
.equalTo(AllTypes.FIELD_LONG, 5) | ||
.beginGroup() | ||
.endGroup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this throw as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No 🤷
assertEquals(1, fives.size()); | ||
} | ||
|
||
@Test (expected = UnsupportedOperationException.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, we only reserve this exception to things not implemented. A more appropriate exception would be IllegalStateException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From documentation of the various RealmQuery
methods it seems like invalid queries (syntax errors) are indicated by throwing UnsupportedOperationException
.
Currently just added tests for queries with empty groups
Closes #7233