opwvhk commented on code in PR #2432:
URL: https://github.com/apache/avro/pull/2432#discussion_r1290306298


##########
lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java:
##########
@@ -300,17 +282,11 @@ public double readDouble() throws IOException {
 
   @Override
   public Utf8 readString(Utf8 old) throws IOException {
-    long length = readLong();
-    if (length > MAX_ARRAY_SIZE) {
-      throw new UnsupportedOperationException("Cannot read strings longer than 
" + MAX_ARRAY_SIZE + " bytes");
-    }
-    if (length < 0L) {
-      throw new AvroRuntimeException("Malformed data. Length is negative: " + 
length);
-    }
+    int length = SystemLimitException.checkMaxStringLength(readLong());

Review Comment:
   Nice result! Especially the similarity to `requireNonNull` in Java.



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

Reply via email to