SONAR suggestions - eliminate lossy arithmetic

Change-Id: I5a02ea407225ee0c9df040b74a8c0dc2ee5d5cb3
This commit is contained in:
Ray Milkey 2018-02-05 13:47:55 -08:00 committed by Thomas Vachuska
parent ef31005fd2
commit 961b19f66d
5 changed files with 5 additions and 5 deletions

View File

@ -263,7 +263,7 @@ public class VbngConfigurationManager implements VbngConfigurationService {
// Judge whether the prefix of this public IP address is used
// up, if so, update the IP prefix status.
int prefixLen = prefix.getKey().prefixLength();
double prefixLen = prefix.getKey().prefixLength();
int availableIpNum = (int) Math.pow(2,
IpPrefix.MAX_INET_MASK_LENGTH - prefixLen) - 1;
int usedIpNum = 0;

View File

@ -194,7 +194,7 @@ public class ConfigFileBasedClusterMetadataProvider implements ClusterMetadataPr
}
try {
Thread.sleep((int) Math.pow(2, iterations < 7 ? ++iterations : iterations) * 10);
Thread.sleep((int) Math.pow(2, iterations < 7 ? ++iterations : iterations) * 10L);
} catch (InterruptedException e) {
throw Throwables.propagate(e);
}

View File

@ -85,7 +85,7 @@ public class LumentumSnmpDevice {
target.setCommunity(new OctetString("public"));
target.setAddress(targetAddress);
target.setRetries(3);
target.setTimeout(1000 * 3);
target.setTimeout(1000L * 3L);
target.setVersion(SnmpConstants.version2c);
target.setMaxSizeRequestPDU(MAX_SIZE_RESPONSE_PDU);
}

View File

@ -65,7 +65,7 @@ class FlowStatsCollector implements SwitchDataCollector {
this.pollInterval = pollInterval;
task.cancel();
task = new InternalTimerTask();
timer.scheduleAtFixedRate(task, pollInterval * SECONDS, pollInterval * 1000);
timer.scheduleAtFixedRate(task, pollInterval * SECONDS, pollInterval * 1000L);
}
private class InternalTimerTask extends TimerTask {

View File

@ -63,7 +63,7 @@ class TableStatisticsCollector implements SwitchDataCollector {
this.pollInterval = pollInterval;
task.cancel();
task = new InternalTimerTask();
timer.scheduleAtFixedRate(task, pollInterval * SECONDS, pollInterval * 1000);
timer.scheduleAtFixedRate(task, pollInterval * SECONDS, pollInterval * 1000L);
}
private class InternalTimerTask extends TimerTask {