Fixed Coverity reported type issues

This commit is contained in:
Santhosh Edukulla 2014-08-06 15:27:00 +05:30
parent bf9036c5a0
commit dda2820552
4 changed files with 13 additions and 12 deletions

View File

@ -177,7 +177,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
@Override
public Integer getSourcePortStart() {
if (publicStartPort != null) {
return publicStartPort.intValue();
return publicStartPort;
}
return null;
}
@ -186,10 +186,10 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
public Integer getSourcePortEnd() {
if (publicEndPort == null) {
if (publicStartPort != null) {
return publicStartPort.intValue();
return publicStartPort;
}
} else {
return publicEndPort.intValue();
return publicEndPort;
}
return null;
@ -247,11 +247,12 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
}
}
}
try {
FirewallRule result = _firewallService.createIngressFirewallRule(this);
setEntityId(result.getId());
setEntityUuid(result.getUuid());
if (result != null) {
setEntityId(result.getId());
setEntityUuid(result.getUuid());
}
} catch (NetworkRuleConflictException ex) {
s_logger.info("Network rule conflict: " + ex.getMessage());
s_logger.trace("Network Rule Conflict: ", ex);

View File

@ -38,8 +38,8 @@ public class StaticNatRuleImpl implements StaticNatRule {
xid = rule.getXid();
uuid = rule.getUuid();
protocol = rule.getProtocol();
portStart = rule.getSourcePortStart();
portEnd = rule.getSourcePortEnd();
portStart = rule.getSourcePortStart().intValue();
portEnd = rule.getSourcePortEnd().intValue();
state = rule.getState();
accountId = rule.getAccountId();
domainId = rule.getDomainId();

View File

@ -363,7 +363,7 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
for (FirewallRule vpnFwRule : vpnFwRules) {
_rulesDao.remove(vpnFwRule.getId());
s_logger.debug("Successfully removed firewall rule with ip id=" + vpnFwRule.getSourceIpAddressId() + " and port " +
vpnFwRule.getSourcePortStart() + " as a part of vpn cleanup");
vpnFwRule.getSourcePortStart().intValue() + " as a part of vpn cleanup");
}
}
}

View File

@ -185,7 +185,7 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
throw new CloudRuntimeException("Unable to update the state to add for " + newRule);
}
s_logger.debug("Load balancer " + newRule.getId() + " for Ip address " + newRule.getSourceIp().addr() + ", source port " +
newRule.getSourcePortStart() + ", instance port " + newRule.getDefaultPortStart() + " is added successfully.");
newRule.getSourcePortStart().intValue() + ", instance port " + newRule.getDefaultPortStart() + " is added successfully.");
CallContext.current().setEventDetails("Load balancer Id: " + newRule.getId());
Network ntwk = _networkModel.getNetwork(newRule.getNetworkId());
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_LOAD_BALANCER_CREATE, newRule.getAccountId(), ntwk.getDataCenterId(), newRule.getId(), null,
@ -527,8 +527,8 @@ public class ApplicationLoadBalancerManagerImpl extends ManagerBase implements A
(newLbRule.getSourcePortStart().intValue() <= lbRule.getSourcePortEnd().intValue() && newLbRule.getSourcePortEnd().intValue() >= lbRule.getSourcePortEnd()
.intValue())) {
throw new NetworkRuleConflictException("The range specified, " + newLbRule.getSourcePortStart() + "-" + newLbRule.getSourcePortEnd() +
", conflicts with rule " + lbRule.getId() + " which has " + lbRule.getSourcePortStart() + "-" + lbRule.getSourcePortEnd());
throw new NetworkRuleConflictException("The range specified, " + newLbRule.getSourcePortStart().intValue() + "-" + newLbRule.getSourcePortEnd().intValue() +
", conflicts with rule " + lbRule.getId() + " which has " + lbRule.getSourcePortStart().intValue() + "-" + lbRule.getSourcePortEnd().intValue());
}
}