You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using iterator created from Json.decodeToSequence method and reading past all items, iterator.hasNext() will throw.
See the repro case where there are two elements in the list, while code tries to read 3 of them.
To Reproduce
val source ="[1, 2]"val input = source.byteInputStream()
input.use {
val iterator =Json.decodeToSequence<Int>(it).iterator()
val values = iterator.asSequence().take(3).toList()
var b = iterator.hasNext() // throws
}
Exception is something like: Exception in thread "main" kotlinx.serialization.json.internal.JsonDecodingException: Expected end of the array ']', but had 'EOF' instead at path: $
Expected result
iterator.hasNext() returns false.
Environment
Kotlin version: 1.8.0
Library version: 2.2.4
Kotlin platforms: JVM
Gradle version: 7.4.2
The text was updated successfully, but these errors were encountered:
When using iterator created from Json.decodeToSequence method and reading past all items, iterator.hasNext() will throw.
See the repro case where there are two elements in the list, while code tries to read 3 of them.
To Reproduce
Exception is something like: Exception in thread "main" kotlinx.serialization.json.internal.JsonDecodingException: Expected end of the array ']', but had 'EOF' instead at path: $
Expected result
iterator.hasNext()
returnsfalse
.Environment
The text was updated successfully, but these errors were encountered: