This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new 164aebf6ed Fix readBytes and writeBytes methods in fastjson2 (#13968)
164aebf6ed is described below

commit 164aebf6ed47d5c06fe5e91ced491bbff5b03abb
Author: TomlongTK <[email protected]>
AuthorDate: Thu Mar 21 16:26:20 2024 +0800

    Fix readBytes and writeBytes methods in fastjson2 (#13968)
---
 .../apache/dubbo/common/serialize/fastjson2/FastJson2ObjectInput.java | 2 +-
 .../dubbo/common/serialize/fastjson2/FastJson2ObjectOutput.java       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/dubbo-serialization/dubbo-serialization-fastjson2/src/main/java/org/apache/dubbo/common/serialize/fastjson2/FastJson2ObjectInput.java
 
b/dubbo-serialization/dubbo-serialization-fastjson2/src/main/java/org/apache/dubbo/common/serialize/fastjson2/FastJson2ObjectInput.java
index a167ea3983..52d486ec67 100644
--- 
a/dubbo-serialization/dubbo-serialization-fastjson2/src/main/java/org/apache/dubbo/common/serialize/fastjson2/FastJson2ObjectInput.java
+++ 
b/dubbo-serialization/dubbo-serialization-fastjson2/src/main/java/org/apache/dubbo/common/serialize/fastjson2/FastJson2ObjectInput.java
@@ -91,7 +91,7 @@ public class FastJson2ObjectInput implements ObjectInput {
 
     @Override
     public byte[] readBytes() throws IOException {
-        int length = is.read();
+        int length = readLength();
         byte[] bytes = new byte[length];
         int read = is.read(bytes, 0, length);
         if (read != length) {
diff --git 
a/dubbo-serialization/dubbo-serialization-fastjson2/src/main/java/org/apache/dubbo/common/serialize/fastjson2/FastJson2ObjectOutput.java
 
b/dubbo-serialization/dubbo-serialization-fastjson2/src/main/java/org/apache/dubbo/common/serialize/fastjson2/FastJson2ObjectOutput.java
index f596b8db4a..0240e009d7 100644
--- 
a/dubbo-serialization/dubbo-serialization-fastjson2/src/main/java/org/apache/dubbo/common/serialize/fastjson2/FastJson2ObjectOutput.java
+++ 
b/dubbo-serialization/dubbo-serialization-fastjson2/src/main/java/org/apache/dubbo/common/serialize/fastjson2/FastJson2ObjectOutput.java
@@ -89,13 +89,13 @@ public class FastJson2ObjectOutput implements ObjectOutput {
 
     @Override
     public void writeBytes(byte[] b) throws IOException {
-        os.write(b.length);
+        writeLength(b.length);
         os.write(b);
     }
 
     @Override
     public void writeBytes(byte[] b, int off, int len) throws IOException {
-        os.write(len);
+        writeLength(len);
         os.write(b, off, len);
     }
 

Reply via email to