You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by GitBox <gi...@apache.org> on 2020/06/30 13:26:58 UTC

[GitHub] [thrift] zeshuai007 opened a new pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

zeshuai007 opened a new pull request #2191:
URL: https://github.com/apache/thrift/pull/2191


   <!-- Explain the changes in the pull request below: -->
     
   
   <!-- We recommend you review the checklist/tips before submitting a pull request. -->
   
   - [ ] Did you create an [Apache Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  (not required for trivial changes)
   - [x] If a ticket exists: Does your pull request title follow the pattern "THRIFT-5237: describe my issue"?
   - [ ] Did you squash your changes to a single commit?  (not required, but preferred)
   - [ ] Did you do your best to avoid breaking changes?  If one was needed, did you label the Jira ticket with "Breaking-Change"?
   - [ ] If your change does not involve any code, include `[skip ci]` anywhere in the commit message to free up build resources.
   
   <!--
     The Contributing Guide at:
     https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
     has more details and tips for committing properly.
   -->
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G commented on a change in pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G commented on a change in pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#discussion_r487426110



##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G commented on pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G commented on pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#issuecomment-684022799


   Could you do a rebase? I'd like to look at this PR.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] zeshuai007 merged pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
zeshuai007 merged pull request #2191:
URL: https://github.com/apache/thrift/pull/2191


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] dcelasun commented on pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
dcelasun commented on pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#issuecomment-697175290


   @zeshuai007 any chance you could do something similar for Go?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G commented on pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G commented on pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#issuecomment-694112472


   +1 review LGTM, not tested. Merge?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G commented on pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G commented on pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#issuecomment-663838072


   Guess we can close this?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G commented on a change in pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G commented on a change in pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#discussion_r487426110



##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?

##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?

##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] zeshuai007 commented on a change in pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
zeshuai007 commented on a change in pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#discussion_r489298393



##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       I'm also surprised that IDEA has modified these spaces.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] zeshuai007 commented on pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
zeshuai007 commented on pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#issuecomment-694683848


   Thank you for reviewing this. I would like to merge it , WDYT ?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G commented on pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G commented on pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#issuecomment-694688472


   Do it.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G commented on a change in pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G commented on a change in pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#discussion_r487426110



##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] LiuXing-R commented on a change in pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
LiuXing-R commented on a change in pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#discussion_r489297170



##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       This is a redundant comment.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] zeshuai007 commented on pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
zeshuai007 commented on pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#issuecomment-686168362


   Done.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G removed a comment on pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G removed a comment on pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#issuecomment-663838072


   Guess we can close this?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] zeshuai007 commented on a change in pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
zeshuai007 commented on a change in pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#discussion_r489299322



##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       This is a redundant comment.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G commented on pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G commented on pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#issuecomment-692901729


   ping


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [thrift] Jens-G commented on a change in pull request #2191: THRIFT-5237 Implement MAX_MESSAGE_SIZE and consolidate limits into a TConfiguration class(JAVA)

Posted by GitBox <gi...@apache.org>.
Jens-G commented on a change in pull request #2191:
URL: https://github.com/apache/thrift/pull/2191#discussion_r487426110



##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?

##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?

##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?

##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?

##########
File path: lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java
##########
@@ -37,868 +38,930 @@
  * and i64 fields you have, the more benefit you'll see.
  */
 public class TCompactProtocol extends TProtocol {
-  private final static byte[] EMPTY_BYTES = new byte[0];
-  private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
-
-  private final static long NO_LENGTH_LIMIT = -1;
-
-  private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
-  private final static TField TSTOP = new TField("", TType.STOP, (short)0);
-
-  private final static byte[] ttypeToCompactType = new byte[16];
-
-  static {
-    ttypeToCompactType[TType.STOP] = TType.STOP;
-    ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
-    ttypeToCompactType[TType.BYTE] = Types.BYTE;
-    ttypeToCompactType[TType.I16] = Types.I16;
-    ttypeToCompactType[TType.I32] = Types.I32;
-    ttypeToCompactType[TType.I64] = Types.I64;
-    ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
-    ttypeToCompactType[TType.STRING] = Types.BINARY;
-    ttypeToCompactType[TType.LIST] = Types.LIST;
-    ttypeToCompactType[TType.SET] = Types.SET;
-    ttypeToCompactType[TType.MAP] = Types.MAP;
-    ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
-  }
-
-  /**
-   * TProtocolFactory that produces TCompactProtocols.
-   */
-  public static class Factory implements TProtocolFactory {
+    private final static byte[] EMPTY_BYTES = new byte[0];
+    private final static ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES);
+
+    private final static long NO_LENGTH_LIMIT = -1;
+
+    private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
+    private final static TField TSTOP = new TField("", TType.STOP, (short) 0);
+
+    private final static byte[] ttypeToCompactType = new byte[16];
+
+    static {
+        ttypeToCompactType[TType.STOP] = TType.STOP;
+        ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
+        ttypeToCompactType[TType.BYTE] = Types.BYTE;
+        ttypeToCompactType[TType.I16] = Types.I16;

Review comment:
       Why all those whitespace changes? The patch is already large enough without these ;-)

##########
File path: lib/java/test/org/apache/thrift/transport/TestAutoExpandingBufferWriteTransport.java
##########
@@ -19,14 +19,16 @@
 package org.apache.thrift.transport;
 
 import java.nio.ByteBuffer;
+
+import org.apache.thrift.TConfiguration;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
 public class TestAutoExpandingBufferWriteTransport {
 
   @Test
   public void testIt() throws Exception {
-    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(1, 0);
+    AutoExpandingBufferWriteTransport t = new AutoExpandingBufferWriteTransport(new TConfiguration(), 1, 0);

Review comment:
       Nut sure but .... wouldnt it be better to instantiate TConfiguration() only once and use it through the whole test case or at least inside the method? 
   

##########
File path: lib/java/src/org/apache/thrift/transport/layered/TFramedTransport.java
##########
@@ -138,22 +135,24 @@ public void clear() {
   private final byte[] i32buf = new byte[4];
 
   private void readFrame() throws TTransportException {
-    transport_.readAll(i32buf, 0, 4);
+    getInnerTransport().readAll(i32buf, 0, 4);
     int size = decodeFrameSize(i32buf);
 
     if (size < 0) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA, "Read a negative frame size (" + size + ")!");
     }
 
-    if (size > maxLength_) {
+    if (size > getInnerTransport().getConfiguration().getMaxFrameSize()) {
       close();
       throw new TTransportException(TTransportException.CORRUPTED_DATA,
-          "Frame size (" + size + ") larger than max length (" + maxLength_ + ")!");
+          "Frame size (" + size + ") larger than max length (" + getInnerTransport().getConfiguration().getMaxFrameSize() + ")!");
     }
 
+    //updateKnownMessageSize(size);

Review comment:
       Added but commented out?

##########
File path: lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
##########
@@ -279,6 +280,10 @@ public void readFieldEnd() throws TException {}
   @Override
   public TMap readMapBegin() throws TException {
     TMap map = new TMap(readByte(), readByte(), readI32());
+
+    //

Review comment:
       there are quite a few emtpy comment lines in here, is there sth missing?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org