activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michaelpea...@apache.org
Subject [activemq-artemis] branch master updated: NO-JIRA Fix a "Computation of average could overflow" SpotBugs warning
Date Thu, 14 Feb 2019 13:42:40 GMT
This is an automated email from the ASF dual-hosted git repository.

michaelpearce pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 6fc6787  NO-JIRA Fix a "Computation of average could overflow" SpotBugs warning
     new 603d72f  This closes #2550
6fc6787 is described below

commit 6fc6787227c11947abf7ef9605a7f2f99ccee987
Author: Jiri Danek <jdanek@redhat.com>
AuthorDate: Thu Feb 14 13:22:11 2019 +0100

    NO-JIRA Fix a "Computation of average could overflow" SpotBugs warning
    
    https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html#im-computation-of-average-could-overflow-im-average-computation-could-overflow
---
 .../apache/activemq/artemis/utils/collections/PriorityCollection.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityCollection.java
b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityCollection.java
index fb96f0b..265b27a 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityCollection.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/PriorityCollection.java
@@ -135,7 +135,7 @@ public class PriorityCollection<T extends PriorityAware> extends
AbstractCollect
       int high = current.length - 1;
 
       while (low <= high) {
-         int mid = (low + high) / 2;
+         int mid = (low + high) >>> 1;
          PriorityHolder<T> midVal = current[mid];
 
          if (midVal.getPriority() > priority)
@@ -203,7 +203,7 @@ public class PriorityCollection<T extends PriorityAware> extends
AbstractCollect
       int high = len - 1;
 
       while (low <= high) {
-         int mid = (low + high) / 2;
+         int mid = (low + high) >>> 1;
          PriorityHolder<T> midVal = current[mid];
 
          if (midVal.getPriority() > priority)


Mime
View raw message