You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/05/02 17:00:57 UTC

[2/4] activemq-artemis git commit: ARTEMIS-1135: Fix potential message count overflow

ARTEMIS-1135: Fix potential message count overflow

Have `AddressControlImpl::getMessageCount` use and return a `long`.
Prevents potential overflow from use of an `int` count variable.
Fixes one of the "Implicit narrowing conversion in compound assignment"
alerts at https://lgtm.com/projects/g/apache/activemq-artemis/alerts.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b998a8bd
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b998a8bd
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b998a8bd

Branch: refs/heads/master
Commit: b998a8bdafd6dbe8c60d75980c4495804dbebc2a
Parents: 33c9463
Author: Aditya Sharad <ad...@semmle.com>
Authored: Sat Apr 29 15:34:06 2017 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue May 2 13:00:46 2017 -0400

----------------------------------------------------------------------
 .../artemis/core/management/impl/AddressControlImpl.java         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b998a8bd/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
index f0a3a77..04b0e4b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
@@ -331,9 +331,9 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
 
    // Private -------------------------------------------------------
 
-   private int getMessageCount(final DurabilityType durability) {
+   private long getMessageCount(final DurabilityType durability) {
       List<QueueControl> queues = getQueues(durability);
-      int count = 0;
+      long count = 0;
       for (QueueControl queue : queues) {
          count += queue.getMessageCount();
       }