Skip to content

Commit f9e1154

Browse files
committed
Fixed few coverity issues
1 parent 3547562 commit f9e1154

4 files changed

Lines changed: 15 additions & 9 deletions

File tree

agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public synchronized boolean configure(String name, Map<String, Object> params) {
100100
}
101101

102102
@Override
103-
public String getName() {
103+
public synchronized String getName() {
104104
return _name;
105105
}
106106

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3988,11 +3988,14 @@ protected Network enableVlanNetwork(Connection conn, long tag, XsLocalNetwork ne
39883988
s_logger.debug("Creating VLAN " + tag + " on host " + _host.ip + " on device " + nPifr.device);
39893989
}
39903990
VLAN vlan = VLAN.create(conn, nPif, tag, vlanNetwork);
3991-
VLAN.Record vlanr = vlan.getRecord(conn);
3992-
if (s_logger.isDebugEnabled()) {
3993-
s_logger.debug("VLAN is created for " + tag + ". The uuid is " + vlanr.uuid);
3991+
if (vlan != null) {
3992+
VLAN.Record vlanr = vlan.getRecord(conn);
3993+
if (vlanr != null) {
3994+
if (s_logger.isDebugEnabled()) {
3995+
s_logger.debug("VLAN is created for " + tag + ". The uuid is " + vlanr.uuid);
3996+
}
3997+
}
39943998
}
3995-
39963999
return vlanNetwork;
39974000
}
39984001

server/src/com/cloud/alert/AlertManagerImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,11 @@ public void recalculateCapacity() {
278278
// Calculate CPU and RAM capacities
279279
// get all hosts...even if they are not in 'UP' state
280280
List<HostVO> hosts = _resourceMgr.listAllNotInMaintenanceHostsInOneZone(Host.Type.Routing, null);
281-
for (HostVO host : hosts) {
282-
_capacityMgr.updateCapacityForHost(host);
281+
if (hosts != null) {
282+
for (HostVO host : hosts) {
283+
_capacityMgr.updateCapacityForHost(host);
284+
}
283285
}
284-
285286
if (s_logger.isDebugEnabled()) {
286287
s_logger.debug("Done executing cpu/ram capacity update");
287288
s_logger.debug("Executing storage capacity update");

server/src/com/cloud/network/IpAddressManagerImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,9 @@ public Ternary<Boolean, List<NetworkOfferingVO>, Network> doInTransaction(Transa
16001600
if (implementedNetwork == null || implementedNetwork.first() == null) {
16011601
s_logger.warn("Failed to implement the network " + guestNetwork);
16021602
}
1603-
guestNetwork = implementedNetwork.second();
1603+
if (implementedNetwork != null) {
1604+
guestNetwork = implementedNetwork.second();
1605+
}
16041606
} catch (Exception ex) {
16051607
s_logger.warn("Failed to implement network " + guestNetwork + " elements and resources as a part of" + " network provision due to ", ex);
16061608
CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified id)"

0 commit comments

Comments
 (0)