quantranhong1999 commented on code in PR #2389:
URL: https://github.com/apache/james-project/pull/2389#discussion_r1732043826


##########
server/protocols/jmap-rfc-8621/src/main/java/org/apache/james/jmap/utils/JsoupHtmlTextExtractor.java:
##########
@@ -40,8 +43,24 @@
 import com.google.common.base.Strings;
 
 public class JsoupHtmlTextExtractor implements HtmlTextExtractor {
-
     private static final Logger LOGGER = 
LoggerFactory.getLogger(JsoupHtmlTextExtractor.class);
+
+    private static class Context {
+        private final long limit;
+        private long outputSize = 0;
+
+        private Context(JmapRfc8621Configuration configuration) {
+            this.limit = configuration.maxSizeAttachmentsPerEmail().asLong();
+        }
+
+        void add(String s) {
+            outputSize += s.length();
+            if (outputSize > limit) {
+                throw new IllegalStateException("text/plain redering exceeds 
message limit");

Review Comment:
   ```suggestion
                   throw new IllegalStateException("text/plain rendering 
exceeds message limit");
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to