You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2021/06/22 19:44:39 UTC

[qpid-broker-j] branch main updated: QPID-8452: Fix validation of maximum message size

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

orudyy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git


The following commit(s) were added to refs/heads/main by this push:
     new 03a9cf4  QPID-8452: Fix validation of maximum message size
03a9cf4 is described below

commit 03a9cf47a2cb23ae7044c023c0d0be8e31d207b0
Author: Marek Laca <mk...@gmail.com>
AuthorDate: Fri Jun 18 14:20:22 2021 +0200

    QPID-8452: Fix validation of maximum message size
    
    This closes #96
---
 .../qpid/server/transport/AbstractAMQPConnection.java       | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java b/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java
index 2536036..74977c3 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java
@@ -144,7 +144,7 @@ public abstract class AbstractAMQPConnection<C extends AbstractAMQPConnection<C,
 
     private volatile boolean _messageAuthorizationRequired;
 
-    private final AtomicLong _maxMessageSize = new AtomicLong(Long.MAX_VALUE);
+    private final AtomicLong _maxMessageSize = new AtomicLong(Integer.MAX_VALUE);
     private volatile int _messageCompressionThreshold;
     private volatile TransactionObserver _transactionObserver;
     private long _maxUncommittedInMemorySize;
@@ -400,19 +400,18 @@ public abstract class AbstractAMQPConnection<C extends AbstractAMQPConnection<C,
 
     private long getMaxMessageSize(final ContextProvider object)
     {
-        long maxMessageSize;
         try
         {
-            maxMessageSize = object.getContextValue(Integer.class, MAX_MESSAGE_SIZE);
+            final int maxMessageSize = object.getContextValue(Integer.class, MAX_MESSAGE_SIZE);
+            return maxMessageSize > 0 ? maxMessageSize : Integer.MAX_VALUE;
         }
         catch (NullPointerException | IllegalArgumentException e)
         {
             LOGGER.warn("Context variable {} has invalid value and cannot be used to restrict maximum message size",
-                         MAX_MESSAGE_SIZE,
-                         e);
-            maxMessageSize = Long.MAX_VALUE;
+                    MAX_MESSAGE_SIZE,
+                    e);
         }
-        return maxMessageSize > 0 ? maxMessageSize : Long.MAX_VALUE;
+        return Integer.MAX_VALUE;
     }
 
     @Override

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org