lidavidm commented on a change in pull request #9147: URL: https://github.com/apache/arrow/pull/9147#discussion_r560200455
########## File path: java/flight/flight-core/src/main/java/org/apache/arrow/flight/ArrowMessage.java ########## @@ -259,7 +259,8 @@ private static ArrowMessage frame(BufferAllocator allocator, final InputStream s ArrowBuf body = null; ArrowBuf appMetadata = null; while (stream.available() > 0) { - int tag = readRawVarint32(stream); + int tag = readRawVarint32WithEOFCheck(stream); + switch (tag) { Review comment: The current code is wrong, though. (It would be entirely valid for available() == 0 even when the stream is not at EOF. The JavaDocs state that EOF implies available() == 0, but not the other way around.) And the PR raises different exceptions for EOF depending on the case. Instead of adding flags to massage the current behavior in different cases, let's write code that adheres to the contract of InputStream. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org