You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2021/02/04 16:46:22 UTC
[dubbo] branch 2.7.8.1-release updated: fix codec ut
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch 2.7.8.1-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/2.7.8.1-release by this push:
new 86a6ec6 fix codec ut
86a6ec6 is described below
commit 86a6ec63377adea26c15b4f58c5c5ed91b6f59c1
Author: ken.lj <ke...@gmail.com>
AuthorDate: Fri Feb 5 00:45:19 2021 +0800
fix codec ut
---
.../java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java | 2 +-
.../test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java
index 5638128..f4c6872 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java
@@ -423,7 +423,7 @@ public class ExchangeCodec extends TelnetCodec {
int dataLen = eventBytes.length;
int threshold = ConfigurationUtils.getSystemConfiguration().getInt("deserialization.event.size", 10);
if (dataLen > threshold) {
- throw new IllegalArgumentException("Event data too long, actual size " + threshold + ", threshold " + threshold + " rejected for security consideration.");
+ throw new IllegalArgumentException("Event data too long, actual size " + dataLen + ", threshold " + threshold + " rejected for security consideration.");
}
}
return in.readEvent();
diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java
index 3133735..3cb2c66 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java
@@ -248,12 +248,14 @@ public class ExchangeCodecTest extends TelnetCodecTest {
Person person = new Person();
byte[] request = getRequestBytes(person, header);
+ System.setProperty("deserialization.event.size", "100");
Request obj = (Request) decode(request);
Assertions.assertEquals(person, obj.getData());
Assertions.assertTrue(obj.isTwoWay());
Assertions.assertTrue(obj.isEvent());
Assertions.assertEquals(Version.getProtocolVersion(), obj.getVersion());
System.out.println(obj);
+ System.clearProperty("deserialization.event.size");
}
@Test
@@ -287,7 +289,7 @@ public class ExchangeCodecTest extends TelnetCodecTest {
@Test
public void test_Decode_Return_Request_Object() throws IOException {
//|10011111|20-stats=ok|id=0|length=0
- byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) 0xe2, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) 0xc2, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Person person = new Person();
byte[] request = getRequestBytes(person, header);