iemejia commented on code in PR #3745:
URL: https://github.com/apache/avro/pull/3745#discussion_r3168673301


##########
lang/java/avro/src/main/java/org/apache/avro/util/NonCopyingByteArrayOutputStream.java:
##########
@@ -21,21 +21,78 @@
 import java.io.ByteArrayOutputStream;
 import java.nio.ByteBuffer;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.avro.SystemLimitException;
+
 /**
  * Utility to make data written to an {@link ByteArrayOutputStream} directly
- * available as a {@link ByteBuffer}.
+ * available as a {@link ByteBuffer}. Optional limit to amount of data which 
may
+ * be written.
  */
 public class NonCopyingByteArrayOutputStream extends ByteArrayOutputStream {
 
+  private static final Logger LOG = 
LoggerFactory.getLogger(NonCopyingByteArrayOutputStream.class);
+
+  /**
+   * System property declaring max size of any decompression stream: {@value}.
+   */
+  private static final String MAX_DECOMPRESS_LENGTH_PROPERTY = 
"org.apache.avro.limits.decompress.maxLength";
+
+  /**
+   * Default limit: {@value}.
+   */
+  private static final long DEFAULT_MAX_DECOMPRESS_LENGTH = 200L * 1024 * 1024;
+
+  private static final long MAX_DECOMPRESS_LENGTH;
+
+  static {
+    String prop = System.getProperty(MAX_DECOMPRESS_LENGTH_PROPERTY);

Review Comment:
   Yes, `MAX_DECOMPRESS_LENGTH_PROPERTY` makes more sense in the 
`SystemLimitException` class



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