Description
When JSON is going to be parsed from chunked input stream (Transfer-Encoding: chunked), it may happen that JSON is not parsed correctly since the read data is prematurely ended. The problem lies in IO class in read method. The assumption that the fact that number of bytes read is lower than the size of destination buffer in Reader.read(char[]) method implicates the end of stream is wrong. Please also find a test case attached - the former test with plain byte stream passes, the latter with chunked input stream reads only 16 first bytes (first chunk). When IO.read() is used in BaseJsonParser on chunked stream the parser may fail with exception then.
Attachments
Attachments
Issue Links
- duplicates
-
GROOVY-7132 JsonSlurper throws exception if reader does not fill complete char buffer
- Closed