Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 92B5EC847 for ; Tue, 2 Jul 2013 13:24:15 +0000 (UTC) Received: (qmail 50977 invoked by uid 500); 2 Jul 2013 13:24:15 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 50845 invoked by uid 500); 2 Jul 2013 13:24:15 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 50830 invoked by uid 99); 2 Jul 2013 13:24:14 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jul 2013 13:24:14 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 0A677539D6; Tue, 2 Jul 2013 13:24:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kishan@apache.org To: commits@cloudstack.apache.org Date: Tue, 02 Jul 2013 13:24:14 -0000 Message-Id: <21cad706fed74c44bfb05b0710927031@git.apache.org> In-Reply-To: <6774e32d54e241ff8651b014731497dc@git.apache.org> References: <6774e32d54e241ff8651b014731497dc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] git commit: updated refs/heads/4.2 to 154618b CLOUDSTACK-3198: HashSet used for storing ACL rules doesn't maintain the order. Added rules directly to result string array after sorting. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/154618b7 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/154618b7 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/154618b7 Branch: refs/heads/4.2 Commit: 154618b75f4e86c2edc9719ebca17e78968922c8 Parents: a52bf1b Author: Kishan Kavala Authored: Tue Jul 2 18:47:09 2013 +0530 Committer: Kishan Kavala Committed: Tue Jul 2 18:51:10 2013 +0530 ---------------------------------------------------------------------- .../cloud/agent/api/routing/SetNetworkACLCommand.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/154618b7/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java index d876c61..236e8ea 100644 --- a/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java +++ b/core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java @@ -43,16 +43,16 @@ public class SetNetworkACLCommand extends NetworkElementCommand{ return rules; } public String[][] generateFwRules() { - String [][] result = new String [2][]; - Set toAdd = new HashSet(); List aclList = Arrays.asList(rules); Collections.sort(aclList, new Comparator() { @Override public int compare(NetworkACLTO acl1, NetworkACLTO acl2) { - return acl1.getNumber() > acl2.getNumber() ? 1 : -1; + return acl1.getNumber() < acl2.getNumber() ? 1 : -1; } }); + String [][] result = new String [2][aclList.size()]; + int i = 0; for (NetworkACLTO aclTO: aclList) { /* example : Ingress:tcp:80:80:0.0.0.0/0:ACCEPT:,Egress:tcp:220:220:0.0.0.0/0:DROP:, * each entry format Ingress/Egress:protocol:start port: end port:scidrs:action: @@ -64,7 +64,7 @@ public class SetNetworkACLCommand extends NetworkElementCommand{ /* This entry is added just to make sure atleast there will one entry in the list to get the ipaddress */ sb.append(aclTO.getTrafficType().toString()).append(":reverted:0:0:0:"); String aclRuleEntry = sb.toString(); - toAdd.add(aclRuleEntry); + result[0][i++] = aclRuleEntry; continue; } @@ -91,11 +91,8 @@ public class SetNetworkACLCommand extends NetworkElementCommand{ } sb.append(":").append(aclTO.getAction()).append(":"); String aclRuleEntry = sb.toString(); - - toAdd.add(aclRuleEntry); - + result[0][i++] = aclRuleEntry; } - result[0] = toAdd.toArray(new String[toAdd.size()]); return result; }