From e28882b8ee88ccc154976d7d4c801774e1a7cded Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 11 Jan 2011 14:18:19 -0800 Subject: [PATCH] eliminating use of multiple variables; using the same var for all protocols (denoting ports for tcp/udp and type/code for icmp) --- .../cloud/network/security/SecurityGroupManagerImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java b/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java index f063958a460..4270d31d860 100644 --- a/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java +++ b/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java @@ -613,21 +613,21 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager, SecurityG return null; } } - IngressRuleVO ingressRule = _ingressRuleDao.findByProtoPortsAndAllowedGroupId(securityGroup.getId(), protocol, startPort != null ? startPort : startPortOrType, endPort != null ? endPort : endPortOrCode, ngVO.getId()); + IngressRuleVO ingressRule = _ingressRuleDao.findByProtoPortsAndAllowedGroupId(securityGroup.getId(), protocol, startPortOrType, endPortOrCode, ngVO.getId()); if (ingressRule != null) { continue; //rule already exists. } - ingressRule = new IngressRuleVO(securityGroup.getId(), startPort != null ? startPort : startPortOrType, endPort != null ? endPort : endPortOrCode, protocol, ngVO.getId(), ngVO.getName(), ngVO.getAccountName()); + ingressRule = new IngressRuleVO(securityGroup.getId(), startPortOrType, endPortOrCode, protocol, ngVO.getId(), ngVO.getName(), ngVO.getAccountName()); ingressRule = _ingressRuleDao.persist(ingressRule); newRules.add(ingressRule); } if(cidrList != null) { for (String cidr: cidrList) { - IngressRuleVO ingressRule = _ingressRuleDao.findByProtoPortsAndCidr(securityGroup.getId(),protocol, startPort != null ? startPort : startPortOrType, endPort != null ? endPort : endPortOrCode, cidr); + IngressRuleVO ingressRule = _ingressRuleDao.findByProtoPortsAndCidr(securityGroup.getId(),protocol, startPortOrType, endPortOrCode, cidr); if (ingressRule != null) { continue; } - ingressRule = new IngressRuleVO(securityGroup.getId(), startPort != null ? startPort : startPortOrType, endPort != null ? endPort : endPortOrCode, protocol, cidr); + ingressRule = new IngressRuleVO(securityGroup.getId(), startPortOrType, endPortOrCode, protocol, cidr); ingressRule = _ingressRuleDao.persist(ingressRule); newRules.add(ingressRule); }