JOHNZON-441 - implement currentEvent for RewindableJsonParser and JsonValueParserAdapter - #145
JOHNZON-441 - implement currentEvent for RewindableJsonParser and JsonValueParserAdapter#145jungm wants to merge 1 commit into
Conversation
…nValueParserAdapter
rmannibucau
left a comment
There was a problem hiding this comment.
I'm not sure the changes enable the ticket, looks like they break the contract to me, is it intended?
Also I think we can just drop this rewindablejsonparser now no? did you test?
| private <T> Stream<T> trackStream(final Stream<T> stream) { | ||
| pendingRewind = false; | ||
| last = delegate.currentEvent(); | ||
| final boolean parallel = stream.isParallel(); |
There was a problem hiding this comment.
if parallel nothing works I think
| } | ||
| } | ||
| }; | ||
| return StreamSupport.stream(tracking, parallel).onClose(stream::close); |
There was a problem hiding this comment.
why closing there, the caller must close it
| return jsonValue; | ||
| } | ||
| } | ||
| /* |
There was a problem hiding this comment.
maybe rework so the diff is accurate? (content is ok once done)
| } | ||
|
|
||
| @Override | ||
| public Event next() { |
There was a problem hiding this comment.
this potentially changes the behavior so should be refined I think if desired (looks ok upfront but having a broken test for it can be sane on the long run)
| return delegate.currentEvent(); | ||
| } | ||
| last = delegate.next(); | ||
| pendingRewind = true; |
There was a problem hiding this comment.
looks wrong to impl it there and violates the contract, if I call it on a new parser it should return null, the method is literally getLast() only (our getLast was pre JSON-P 2.1 as a minimum target)
Fixes https://issues.apache.org/jira/browse/JOHNZON-441