Skip to content

Commit

Permalink
Fixed condition when IllegalStateException should be thrown on LazySi…
Browse files Browse the repository at this point in the history
…zedCollection forUpdate/notForUpdate
  • Loading branch information
Tapac committed Oct 31, 2018
1 parent 049504a commit 9e12a11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/org/jetbrains/exposed/sql/IterableEx.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ class LazySizedCollection<out T>(val delegate: SizedIterable<T>): SizedIterable<
override fun count() = _wrapper?.size ?: _count()
override fun empty() = _wrapper?.isEmpty() ?: _empty()
override fun forUpdate(): SizedIterable<T> {
if (_wrapper != null && (delegate as? Query)?.isForUpdate() != true) {
if (_wrapper != null && delegate is Query && !delegate.isForUpdate()) {
throw IllegalStateException("Impossible to change forUpdate state for loaded data")
}
return delegate.forUpdate()
}
override fun notForUpdate(): SizedIterable<T> {
if (_wrapper != null && (delegate as? Query)?.isForUpdate() != false) {
if (_wrapper != null && delegate is Query && delegate.isForUpdate()) {
throw IllegalStateException("Impossible to change forUpdate state for loaded data")
}
return delegate.notForUpdate()
Expand Down

0 comments on commit 9e12a11

Please sign in to comment.