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


##########
lang/java/avro/src/main/java/org/apache/avro/SystemLimitException.java:
##########
@@ -89,6 +114,44 @@ private static int getLimitFromProperty(String property, 
int defaultValue) {
     return i;
   }
 
+  /**
+   * Get a long value stored in a system property, used to configure the system
+   * behaviour of output.
+   *
+   * @param property     The system property to fetch
+   * @param defaultValue The value to use if the system property is not 
present or
+   *                     parsable as a long
+   * @return The value from the system property
+   */
+  private static long getLongLimitFromProperty(String property, long 
defaultValue) {
+    String prop = System.getProperty(property);
+    long limit = defaultValue;
+    if (prop != null) {
+      try {
+        long parsed = Long.parseLong(prop);
+        if (parsed <= 0) {
+          LOG.warn("Invalid value '{}' for property '{}': must be positive. 
Using default: {}", prop, property,
+              defaultValue);
+        } else {
+          limit = parsed;
+        }
+      } catch (NumberFormatException e) {
+        LOG.warn("Could not parse property '{}' value '{}'. Using default: 
{}", property, prop, defaultValue);
+      }
+    }
+    return limit;
+  }
+
+  /**
+   * Calculate a max decompression length as a fraction of
+   * the maximum memory of the runtime.
+   * @return the calculated max default decompression length.
+   */

Review Comment:
   ```suggestion
     /**
      * Calculate a max decompression length as a fraction of the maximum 
memory of
      * the runtime.
      * 
      * @return the calculated max default decompression length.
      */
   ```
   Spotless 🙄 -- sorry about that!



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