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

jiangtian pushed a commit to branch detect_singular_frame_size_13
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit b5d2041efa6a2e019ad9633ed1afb2455522e835
Author: Tian Jiang <[email protected]>
AuthorDate: Fri Dec 27 14:56:05 2024 +0800

    spotless
---
 .../apache/iotdb/rpc/TElasticFramedTransport.java  |  7 +++--
 .../iotdb/rpc/TElasticFramedTransportTest.java     | 33 ++++++++++++++--------
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git 
a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
 
b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
index b77ef614311..4c7602c8699 100644
--- 
a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
+++ 
b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
@@ -132,8 +132,11 @@ public class TElasticFramedTransport extends TTransport {
       close();
       if (size == 1195725856L || size == 1347375956L) {
         // if someone sends HTTP GET/POST to this port, the size will be read 
as the following
-        throw new TTransportException(TTransportException.CORRUPTED_DATA,
-            "Singular frame size (" + size + ") detected, you may be sending 
HTTP GET/POST requests to the Thrift-RPC port, please confirm that you are 
using the right port");
+        throw new TTransportException(
+            TTransportException.CORRUPTED_DATA,
+            "Singular frame size ("
+                + size
+                + ") detected, you may be sending HTTP GET/POST requests to 
the Thrift-RPC port, please confirm that you are using the right port");
       } else {
         throw new TTransportException(
             TTransportException.CORRUPTED_DATA,
diff --git 
a/iotdb-client/service-rpc/src/test/java/org/apache/iotdb/rpc/TElasticFramedTransportTest.java
 
b/iotdb-client/service-rpc/src/test/java/org/apache/iotdb/rpc/TElasticFramedTransportTest.java
index f497ad6f38a..086dc338250 100644
--- 
a/iotdb-client/service-rpc/src/test/java/org/apache/iotdb/rpc/TElasticFramedTransportTest.java
+++ 
b/iotdb-client/service-rpc/src/test/java/org/apache/iotdb/rpc/TElasticFramedTransportTest.java
@@ -19,24 +19,29 @@
 
 package org.apache.iotdb.rpc;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
 import org.apache.thrift.transport.TByteBuffer;
 import org.apache.thrift.transport.TTransportException;
 import org.junit.Test;
 
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 public class TElasticFramedTransportTest {
 
   @Test
   public void testSingularSize() {
 
     try {
-      TElasticFramedTransport transport = new TElasticFramedTransport(
-          new TByteBuffer(ByteBuffer.wrap("GET 127.0.0.1 HTTP/1.1".getBytes(
-              StandardCharsets.UTF_8))), 128 * 1024 * 1024, 512 * 1024 * 1024, 
false);
+      TElasticFramedTransport transport =
+          new TElasticFramedTransport(
+              new TByteBuffer(
+                  ByteBuffer.wrap("GET 127.0.0.1 
HTTP/1.1".getBytes(StandardCharsets.UTF_8))),
+              128 * 1024 * 1024,
+              512 * 1024 * 1024,
+              false);
       transport.open();
       transport.read(ByteBuffer.allocate(4096));
       fail("Exception expected");
@@ -47,9 +52,13 @@ public class TElasticFramedTransportTest {
     }
 
     try {
-      TElasticFramedTransport transport = new TElasticFramedTransport(
-          new TByteBuffer(ByteBuffer.wrap("POST 127.0.0.1 HTTP/1.1".getBytes(
-              StandardCharsets.UTF_8))), 128 * 1024 * 1024, 512 * 1024 * 1024, 
false);
+      TElasticFramedTransport transport =
+          new TElasticFramedTransport(
+              new TByteBuffer(
+                  ByteBuffer.wrap("POST 127.0.0.1 
HTTP/1.1".getBytes(StandardCharsets.UTF_8))),
+              128 * 1024 * 1024,
+              512 * 1024 * 1024,
+              false);
       transport.open();
       transport.read(ByteBuffer.allocate(4096));
       fail("Exception expected");
@@ -59,4 +68,4 @@ public class TElasticFramedTransportTest {
           e.getMessage());
     }
   }
-}
\ No newline at end of file
+}

Reply via email to