-
Notifications
You must be signed in to change notification settings - Fork 130
NullPointerException in PagedSeq/StreamReader #70
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
Comments
Seems to be a problem in PagedSeq. StreamReader calls |
Thanks for such a quick fix But it appears Seth Tisue has deleted https://issues.scala-lang.org/browse/SI-9480, which I believe is the bug you submitted your pull request with the fix against... |
Yeah, he did. Don't know why. @SethTisue, would you mind elaborating a bit? Anyway, the fix is here: scala/scala#4753 |
I apologize. I messed this up. I hastily assumed this would turn out to be a parser combinators bug, and when you discovered it wasn't, I failed to register that, so I thought the original ticket had no further value. I'll comment on the PR about our options now. |
@Ichoran, all: perhaps we should deprecate PagedSeq in 2.12? Is it an obscure, special-purpose thing that probably doesn't have other clients besides scala.util.parser.combinators? |
@SethTisue - I would recommend deprecating it if we can. It is a pretty weirdly-behaved collection even when it isn't throwing NPEs. I don't know its usage pattern, though. |
See scala/scala-parser-combinators#70 Basically the same thing as SI-6615, including the fact everything works okay if the PagedSeq is printed before calling slice. It might seem strange that this allows taking slices that start beyond the end, but - this was possible anyway if one forced the entire sequence, and - it is reasonable to be able to take a slice at the very end (not beyond it) and get an empty sequence, which is exactly what StreamReader in scala-parser-combinators does and gets an NPE.
See scala/scala-parser-combinators#70 Basically the same thing as SI-6615, including the fact everything works okay if the PagedSeq is printed before calling slice. It might seem strange that this allows taking slices that start beyond the end, but - this was possible anyway if one forced the entire sequence, and - it is reasonable to be able to take a slice at the very end (not beyond it) and get an empty sequence, which is exactly what StreamReader in scala-parser-combinators does and gets an NPE.
I started a scala-language thread on the possible deprecation: https://groups.google.com/d/msg/scala-language/gq8iueZmjjg/QQGFZIZsAAAJ |
This was fixed in 2.11.8 (scala/scala#4758). |
(note that it would still be nice to have #71 addressed so that PagedSeq can be removed from Scala 2.13) |
Yes, I'm looking into what it can be replaced with. |
I'm getting a NullPointerException when using the Scala JSON parser on a stream. If I read the contents of the stream into a String and parse that instead, then it completes with no error. That suggests it's not an error in the JSON parser, it is in the StreamReader and/or PagedSeq collection classes. The stack trace is:
The text was updated successfully, but these errors were encountered: