ahmedabu98 commented on code in PR #36073:
URL: https://github.com/apache/beam/pull/36073#discussion_r2337920150


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonUtils.java:
##########
@@ -63,14 +69,52 @@ public static void increaseDefaultStreamReadConstraints(int 
newLimit) {
   }
 
   static {
-    increaseDefaultStreamReadConstraints(100 * 1024 * 1024);
+    increaseDefaultStreamReadConstraints(MAX_STRING_LENGTH);
+  }
+
+  private static boolean streamReadConstraintsAvailable() {
+    try {
+      Class.forName("com.fasterxml.jackson.core.StreamReadConstraints");
+      return true;
+    } catch (ClassNotFoundException e) {
+      return false;
+    }
+  }
+
+  private static class StreamReadConstraintsHelper {
+    static void setStreamReadConstraints(JsonFactory jsonFactory, int 
sizeLimit) {
+      com.fasterxml.jackson.core.StreamReadConstraints streamReadConstraints =
+          com.fasterxml.jackson.core.StreamReadConstraints.builder()
+              .maxStringLength(sizeLimit)
+              .build();
+      jsonFactory.setStreamReadConstraints(streamReadConstraints);
+    }
+  }

Review Comment:
   Not sure why Gemini asked you to put this method in a nested class, but 
looks good either way.



-- 
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: github-unsubscr...@beam.apache.org

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

Reply via email to