This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch activemq-5.19.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-5.19.x by this push:
     new 780008cdcd AMQ-9716: Fix `maxMessageSize=-1` to correctly disable 
message size limit (#1441) (#1441)
780008cdcd is described below

commit 780008cdcdb44afccaee821cd901abbab859305b
Author: Andrey Litvitski <andrey1010102...@gmail.com>
AuthorDate: Wed May 28 18:01:06 2025 +0300

    AMQ-9716: Fix `maxMessageSize=-1` to correctly disable message size limit 
(#1441) (#1441)
    
    (cherry picked from commit d226bfeb14fdc3efa1d33e35a95882435cc4a6c9)
---
 .../src/main/java/org/apache/activemq/web/MessageServletSupport.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java 
b/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
index d038295f9f..643f2deb18 100644
--- 
a/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
+++ 
b/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
@@ -358,7 +358,7 @@ public abstract class MessageServletSupport extends 
HttpServlet {
         if (answer == null && contentType != null && contentLengthLong > -1l) {
             LOG.debug("Content-Type={} Content-Length={} maxMessageSize={}", 
contentType, contentLengthLong, maxMessageSize);
 
-            if (contentLengthLong > maxMessageSize) {
+            if (maxMessageSize != -1 && contentLengthLong > maxMessageSize) {
                 LOG.warn("Message body exceeds max allowed size. 
Content-Type={} Content-Length={} maxMessageSize={}", contentType, 
contentLengthLong, maxMessageSize);
                 throw new IOException("Message body exceeds max allowed size");
             }
@@ -397,6 +397,6 @@ public abstract class MessageServletSupport extends 
HttpServlet {
     }
 
     private boolean isMaxBodySizeExceeded(int totalRead, int expectedBodySize) 
{
-        return totalRead < 0 || totalRead >= Integer.MAX_VALUE || totalRead >= 
maxMessageSize || totalRead > expectedBodySize;
+        return totalRead < 0 || totalRead == Integer.MAX_VALUE || 
(maxMessageSize != -1 && totalRead >= maxMessageSize) || totalRead > 
expectedBodySize;
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@activemq.apache.org
For additional commands, e-mail: commits-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to