diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java index 06669359e86..7595d368ae5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java @@ -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); diff --git a/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java b/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java index 9a49db0ca1c..d21159bdff6 100644 --- a/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java +++ b/engine/components-api/src/com/cloud/network/rules/StaticNatRuleImpl.java @@ -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(); diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java index f4d89478246..f9a15865efe 100755 --- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java +++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java @@ -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"); } } } diff --git a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java index af8dc827890..bc2f1c4da47 100644 --- a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java +++ b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java @@ -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()); } }