lukemin89 commented on a change in pull request #955:
URL: https://github.com/apache/avro/pull/955#discussion_r484635787



##########
File path: lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java
##########
@@ -119,16 +120,21 @@ public Utf8 setByteLength(int newLength) {
     }
     this.length = newLength;
     this.string = null;
-    this.hasHash = false;
+    this.hash = 0;
     return this;
   }
 
   /** Set to the contents of a String. */
   public Utf8 set(String string) {
-    this.bytes = getBytesFor(string);
-    this.length = bytes.length;
+    byte[] bytes = getBytesFor(string);
+    int length = bytes.length;
+    if (length > MAX_LENGTH) {
+      throw new AvroRuntimeException("String length " + length + " exceeds 
maximum allowed");
+    }

Review comment:
       If it is, the other 2 constructors need to be changed as well.




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


Reply via email to