RainYuY commented on code in PR #16045:
URL: https://github.com/apache/dubbo/pull/16045#discussion_r2766925592


##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleCustomerProtocolWrapper.java:
##########
@@ -317,6 +398,56 @@ public byte[] toByteArray() {
             return byteBuffer.array();
         }
 
+        public static TripleRequestWrapper parseFrom(InputStream inputStream) 
throws IOException {
+            TripleRequestWrapper tripleRequestWrapper = new 
TripleRequestWrapper();
+            tripleRequestWrapper.args = new ArrayList<>();
+            tripleRequestWrapper.argTypes = new ArrayList<>();
+            int b;
+            while ((b = inputStream.read()) != -1) {
+                int tag = b;
+                if ((b & 0x80) != 0) {
+                    int shift = 7;
+                    tag = b & 0x7F;
+                    while (shift < 35) {
+                        b = inputStream.read();
+                        if (b == -1) {
+                            throw new IOException("Unexpected end of stream 
while reading tag");
+                        }
+                        tag |= (b & 0x7F) << shift;
+                        if ((b & 0x80) == 0) {
+                            break;

Review Comment:
   Have we encoded it using this method?
   



##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleCustomerProtocolWrapper.java:
##########
@@ -317,6 +398,56 @@ public byte[] toByteArray() {
             return byteBuffer.array();
         }
 
+        public static TripleRequestWrapper parseFrom(InputStream inputStream) 
throws IOException {
+            TripleRequestWrapper tripleRequestWrapper = new 
TripleRequestWrapper();
+            tripleRequestWrapper.args = new ArrayList<>();
+            tripleRequestWrapper.argTypes = new ArrayList<>();
+            int b;
+            while ((b = inputStream.read()) != -1) {
+                int tag = b;
+                if ((b & 0x80) != 0) {
+                    int shift = 7;
+                    tag = b & 0x7F;
+                    while (shift < 35) {

Review Comment:
   There is duplicate code here—please extract it into a separate method.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to