You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/10/21 11:38:48 UTC

[GitHub] [flink] Myasuka commented on a diff in pull request #20860: [FLINK-29347] [runtime] Fix ByteStreamStateHandle#read return -1 when read count is 0

Myasuka commented on code in PR #20860:
URL: https://github.com/apache/flink/pull/20860#discussion_r1001688491


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/memory/ByteStreamStateHandle.java:
##########
@@ -148,7 +148,7 @@ public int read(byte[] b, int off, int len) throws IOException {
                 index += bytesToCopy;
                 return bytesToCopy;
             } else {
-                return -1;
+                return len == 0 ? 0 : -1;

Review Comment:
   I see, and I checked some implementations such as `SSLSocketImpl`, `javax.sound.sampled.AudioInputStream`, they all return -1 for `#read()` method if no more bytes.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org