Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7028

Chunked input stream incorrectly handled in IO.read()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.3.6, 2.4.0-beta-2
    • None
    • JSON

    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

        1. IOReadTest.groovy
          1 kB
          Michal Karwanski

        Issue Links

          Activity

            People

              pschumacher Pascal Schumacher
              karwer Michal Karwanski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: