You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "gaoyunhaii (via GitHub)" <gi...@apache.org> on 2023/04/13 08:25:03 UTC

[GitHub] [flink] gaoyunhaii commented on a diff in pull request #22335: [FLINK-31708][API / Type Serialization System] make DataInputView#read(byte[], int, int) return 0 if len is 0.

gaoyunhaii commented on code in PR #22335:
URL: https://github.com/apache/flink/pull/22335#discussion_r1165181015


##########
flink-core/src/test/java/org/apache/flink/core/memory/DataInputDeserializerTest.java:
##########
@@ -54,4 +54,14 @@ public void testAvailable() throws Exception {
         }
         Assert.assertEquals(0, dis.available());
     }
+
+    @Test
+    public void testReadWithLenZero() throws IOException {
+        byte[] bytes = new byte[] {};
+        DataInputDeserializer dis = new DataInputDeserializer(bytes, 0, bytes.length);
+        Assert.assertEquals(0, dis.available());
+
+        byte[] bytesForRead = new byte[] {};
+        Assert.assertEquals(0, dis.read(bytes, 0, 0)); // do not throw when read with len 0

Review Comment:
   nit: should here be `dis.read(bytesForRead, 0, 0))` ? 



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