mirror of https://github.com/apache/activemq.git
Merge pull request #505 from PascalSchumacher/potential_overflow_in_int_multiplication
Avoid potential overflow in int multiplication before it is converted…
This commit is contained in:
commit
0444dd96b2
|
@ -118,7 +118,7 @@ public class TransportStatusDetector implements Service, Runnable {
|
||||||
public void stop() throws Exception {
|
public void stop() throws Exception {
|
||||||
started.set(false);
|
started.set(false);
|
||||||
if (runner != null) {
|
if (runner != null) {
|
||||||
runner.join(getSweepInterval() * 5);
|
runner.join(getSweepInterval() * 5L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class BitArrayBin implements Serializable {
|
||||||
last = list.get(lastBitArrayIndex);
|
last = list.get(lastBitArrayIndex);
|
||||||
if (last != null) {
|
if (last != null) {
|
||||||
result += last.length() -1;
|
result += last.length() -1;
|
||||||
result += lastBitArrayIndex * BitArray.LONG_SIZE;
|
result += lastBitArrayIndex * (long) BitArray.LONG_SIZE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1237,7 +1237,7 @@ public class PageFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
private long recoveryFileSizeForPages(int pageCount) {
|
private long recoveryFileSizeForPages(int pageCount) {
|
||||||
return RECOVERY_FILE_HEADER_SIZE + ((pageSize + 8) * pageCount);
|
return RECOVERY_FILE_HEADER_SIZE + ((pageSize + 8L) * pageCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void releaseCheckpointWaiter() {
|
private void releaseCheckpointWaiter() {
|
||||||
|
|
|
@ -726,7 +726,7 @@ public class Transaction implements Iterable<Page> {
|
||||||
Long key = page.getPageId();
|
Long key = page.getPageId();
|
||||||
|
|
||||||
// how much pages we have for this transaction
|
// how much pages we have for this transaction
|
||||||
size = writes.size() * pageFile.getPageSize();
|
size = writes.size() * (long) pageFile.getPageSize();
|
||||||
|
|
||||||
PageWrite write;
|
PageWrite write;
|
||||||
|
|
||||||
|
|
|
@ -694,7 +694,7 @@ public class MQTTProtocolConverter {
|
||||||
// Client has sent a valid CONNECT frame, we can stop the connect checker.
|
// Client has sent a valid CONNECT frame, we can stop the connect checker.
|
||||||
monitor.stopConnectChecker();
|
monitor.stopConnectChecker();
|
||||||
|
|
||||||
long keepAliveMS = keepAliveSeconds * 1000;
|
long keepAliveMS = keepAliveSeconds * 1000L;
|
||||||
|
|
||||||
LOG.debug("MQTT Client {} requests heart beat of {} ms", getClientId(), keepAliveMS);
|
LOG.debug("MQTT Client {} requests heart beat of {} ms", getClientId(), keepAliveMS);
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class JMSMemtest {
|
||||||
reportName = settings.getProperty("reportName");
|
reportName = settings.getProperty("reportName");
|
||||||
destinationName = settings.getProperty("destinationName");
|
destinationName = settings.getProperty("destinationName");
|
||||||
reportDirectory = settings.getProperty("reportDirectory");
|
reportDirectory = settings.getProperty("reportDirectory");
|
||||||
connectionInterval = connectionCheckpointSize * 1024;
|
connectionInterval = connectionCheckpointSize * 1024L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -171,7 +171,7 @@ public class JMSMemtest {
|
||||||
|
|
||||||
protected boolean resetConnection(int counter) {
|
protected boolean resetConnection(int counter) {
|
||||||
if (connectionInterval > 0) {
|
if (connectionInterval > 0) {
|
||||||
long totalMsgSizeConsumed = counter * 1024;
|
long totalMsgSizeConsumed = counter * 1024L;
|
||||||
if (connectionInterval < totalMsgSizeConsumed) {
|
if (connectionInterval < totalMsgSizeConsumed) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue