Commit 29c3edf5 authored by Nikolay's avatar Nikolay

Fixed FindBugs warnings

parent 8670471c
...@@ -146,7 +146,7 @@ public class NetDatacenterBroker extends SimEntity { ...@@ -146,7 +146,7 @@ public class NetDatacenterBroker extends SimEntity {
getCloudletList().addAll(list); getCloudletList().addAll(list);
} }
public void setLinkDC(NetworkDatacenter alinkDC) { public static void setLinkDC(NetworkDatacenter alinkDC) {
linkDC = alinkDC; linkDC = alinkDC;
} }
......
...@@ -80,7 +80,7 @@ public class NetworkDatacenter extends Datacenter { ...@@ -80,7 +80,7 @@ public class NetworkDatacenter extends Datacenter {
Switchlist = new HashMap<Integer, Switch>(); Switchlist = new HashMap<Integer, Switch>();
} }
public Map<Integer, Integer> VmToSwitchid; public Map<Integer, Integer> VmToSwitchid = new HashMap<Integer, Integer>();
public Map<Integer, Integer> HostToSwitchid; public Map<Integer, Integer> HostToSwitchid;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
package org.cloudbus.cloudsim.network.datacenter; package org.cloudbus.cloudsim.network.datacenter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -64,13 +65,13 @@ public class Switch extends SimEntity { ...@@ -64,13 +65,13 @@ public class Switch extends SimEntity {
// something is running on these hosts // something is running on these hosts
public SortedMap<Double, List<NetworkVm>> fintimelistVM = new TreeMap<Double, List<NetworkVm>>(); public SortedMap<Double, List<NetworkVm>> fintimelistVM = new TreeMap<Double, List<NetworkVm>>();
public ArrayList<NetworkPacket> pktlist; public ArrayList<NetworkPacket> pktlist = new ArrayList<NetworkPacket>();
public List<Vm> BagofTaskVm = new ArrayList<Vm>(); public List<Vm> BagofTaskVm = new ArrayList<Vm>();
public double switching_delay; public double switching_delay;
public Map<Integer, NetworkVm> Vmlist; public Map<Integer, NetworkVm> Vmlist = new HashMap<Integer, NetworkVm>();
public Switch(String name, int level, NetworkDatacenter dc) { public Switch(String name, int level, NetworkDatacenter dc) {
super(name); super(name);
......
...@@ -311,7 +311,7 @@ public class MathUtil { ...@@ -311,7 +311,7 @@ public class MathUtil {
double[] estimates = tricubeBySquareRegression.regress() double[] estimates = tricubeBySquareRegression.regress()
.getParameterEstimates(); .getParameterEstimates();
if (estimates[0] == Double.NaN || estimates[1] == Double.NaN) { if (Double.isNaN(estimates[0]) || Double.isNaN(estimates[1])) {
return tricubeRegression.regress().getParameterEstimates(); return tricubeRegression.regress().getParameterEstimates();
} }
return estimates; return estimates;
......
...@@ -404,8 +404,9 @@ public class WorkloadFileReader implements WorkloadModel { ...@@ -404,8 +404,9 @@ public class WorkloadFileReader implements WorkloadModel {
// read one line at the time // read one line at the time
int line = 1; int line = 1;
while (reader.ready()) { String readLine = null;
parseValue(reader.readLine(), line); while (reader.ready() && (readLine = reader.readLine()) != null) {
parseValue(readLine, line);
line++; line++;
} }
...@@ -435,9 +436,10 @@ public class WorkloadFileReader implements WorkloadModel { ...@@ -435,9 +436,10 @@ public class WorkloadFileReader implements WorkloadModel {
reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(fl)))); reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(fl))));
// read one line at the time // read one line at the time
int line = 1; int line = 1;
while (reader.ready()) { String readLine = null;
parseValue(reader.readLine(), line); while (reader.ready() && (readLine = reader.readLine()) != null) {
parseValue(readLine, line);
line++; line++;
} }
...@@ -475,9 +477,10 @@ public class WorkloadFileReader implements WorkloadModel { ...@@ -475,9 +477,10 @@ public class WorkloadFileReader implements WorkloadModel {
reader = new BufferedReader(new InputStreamReader(zipFile.getInputStream(zipEntry))); reader = new BufferedReader(new InputStreamReader(zipFile.getInputStream(zipEntry)));
// read one line at the time // read one line at the time
int line = 1; int line = 1;
while (reader.ready()) { String readLine = null;
parseValue(reader.readLine(), line); while (reader.ready() && (readLine = reader.readLine()) != null) {
parseValue(readLine, line);
line++; line++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment