diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java index da104244d9..ae9093d593 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientMessageImpl.java @@ -387,7 +387,7 @@ public class ClientMessageImpl extends CoreMessage implements ClientMessageInter if (isLargeMessage()) { return getBodyBuffer().writerIndex(); } else { - return getBodyBuffer().writerIndex() - BODY_OFFSET; + return (long) getBodyBuffer().writerIndex() - BODY_OFFSET; } } diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedSequentialFile.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedSequentialFile.java index a54a7b16d7..9990bf909c 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedSequentialFile.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedSequentialFile.java @@ -110,7 +110,7 @@ final class MappedSequentialFile implements SequentialFile { @Override public boolean fits(int size) { checkIsOpen(); - final long newPosition = this.mappedFile.position() + size; + final long newPosition = (long) this.mappedFile.position() + size; final boolean hasRemaining = newPosition <= this.mappedFile.length(); return hasRemaining; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index 56bae5422f..fac18ef85a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -1398,9 +1398,9 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { if (pageSubscription != null) { // messageReferences will have depaged messages which we need to discount from the counter as they are // counted on the pageSubscription as well - return pendingMetrics.getMessageCount() + getScheduledCount() + getDeliveringCount() + pageSubscription.getMessageCount(); + return (long) pendingMetrics.getMessageCount() + getScheduledCount() + getDeliveringCount() + pageSubscription.getMessageCount(); } else { - return pendingMetrics.getMessageCount() + getScheduledCount() + getDeliveringCount(); + return (long) pendingMetrics.getMessageCount() + getScheduledCount() + getDeliveringCount(); } } @@ -1419,9 +1419,9 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { public long getDurableMessageCount() { if (isDurable()) { if (pageSubscription != null) { - return pendingMetrics.getDurableMessageCount() + getDurableScheduledCount() + getDurableDeliveringCount() + pageSubscription.getMessageCount(); + return (long) pendingMetrics.getDurableMessageCount() + getDurableScheduledCount() + getDurableDeliveringCount() + pageSubscription.getMessageCount(); } else { - return pendingMetrics.getDurableMessageCount() + getDurableScheduledCount() + getDurableDeliveringCount(); + return (long) pendingMetrics.getDurableMessageCount() + getDurableScheduledCount() + getDurableDeliveringCount(); } } return 0; diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index f44545bc4f..8f7880b62c 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -1334,7 +1334,7 @@ public abstract class ActiveMQTestBase extends Assert { final ActiveMQServer backup) { ClientSessionFactoryInternal sessionFactory = (ClientSessionFactoryInternal) sessionFactoryP; final ActiveMQServerImpl actualServer = (ActiveMQServerImpl) backup; - final long toWait = seconds * 1000; + final long toWait = seconds * 1000L; final long time = System.currentTimeMillis(); int loop = 0; //Note: if maxLoop is too small there won't be @@ -1382,7 +1382,7 @@ public abstract class ActiveMQTestBase extends Assert { public static final void waitForRemoteBackup(ClientSessionFactory sessionFactory, int seconds) { ClientSessionFactoryInternal factoryInternal = (ClientSessionFactoryInternal) sessionFactory; - final long toWait = seconds * 1000; + final long toWait = seconds * 1000L; final long time = System.currentTimeMillis(); while (true) { if (factoryInternal.getBackupConnector() != null) { @@ -1783,7 +1783,7 @@ public abstract class ActiveMQTestBase extends Assert { journal.load(committedRecords, preparedTransactions, null, false); for (RecordInfo info : committedRecords) { - Integer ikey = new Integer(info.getUserRecordType()); + Integer ikey = (int) info.getUserRecordType(); AtomicInteger value = recordsType.get(ikey); if (value == null) { value = new AtomicInteger(); @@ -1812,7 +1812,7 @@ public abstract class ActiveMQTestBase extends Assert { if (key == 0) { System.out.println("huh?"); } - Integer ikey = new Integer(key); + Integer ikey = (int) key; AtomicInteger value = recordsType.get(ikey); if (value == null) { value = new AtomicInteger(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java index fd2172961b..b62bc917f8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java @@ -67,7 +67,7 @@ public class PageCountSyncOnNonTXTest extends SpawnedTestBase { public void setUp() throws Exception { super.setUp(); - timeToRun = 30000 + RandomUtil.randomPositiveInt() % 1000; + timeToRun = 30000L + RandomUtil.randomPositiveInt() % 1000; } @Test