-
Notifications
You must be signed in to change notification settings - Fork 228
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
loadObject should return unique result #784
Conversation
return it.next(); | ||
Object obj = it.next(); | ||
if (!it.hasNext()) { | ||
return obj; |
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.
Does this fix an actual issue?
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.
Maybe throw an exception instead of returning null.
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.
The contract is for loadObject
to return null if no object is loaded. But perhaps we can throw an exception when too many are returned.
return it.next(); | ||
Object obj = it.next(); | ||
if (!it.hasNext()) { | ||
return obj; |
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.
Maybe throw an exception instead of returning null.
815cbec
to
483d9e8
Compare
If the default datastore
loadObject
fails to filter to a single result, do not return any.Currently the first element of the collection would erroneously be returned.