ARTEMIS-2320 Fix IntLongMath errorprone warning
Expression of type int may overflow before being assigned to a long (see https://errorprone.info/bugpattern/IntLongMath)
This commit is contained in:
parent
fc51a5fcde
commit
f7a36300ef
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue