You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/06/26 06:01:13 UTC

[11/16] git commit: VPC: fixed NPE in network ACL delete (ip address is null for the rule of this type_

VPC: fixed NPE in network ACL delete (ip address is null for the rule of this type_


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/d3ccc3a7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/d3ccc3a7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/d3ccc3a7

Branch: refs/heads/vpc
Commit: d3ccc3a7de859e7e14bc093315d1ba4861dd3fe4
Parents: 030458a
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Fri Jun 22 15:06:09 2012 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Mon Jun 25 20:55:37 2012 -0700

----------------------------------------------------------------------
 .../network/firewall/FirewallManagerImpl.java      |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d3ccc3a7/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
index 62901df..7d0a785 100644
--- a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
+++ b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
@@ -420,15 +420,15 @@ public class FirewallManagerImpl implements FirewallService, FirewallManager, Ma
 
     @DB
     protected void removeRule(FirewallRule rule) {
-        //Lock ip address
-        IpAddress ip = _ipAddressDao.findById(rule.getSourceIpAddressId());
-       
+        
         Transaction txn = Transaction.currentTxn();
         txn.start();
         //remove the rule
         _firewallDao.remove(rule.getId());
-        if (ip.getVpcId() != null && _firewallDao.listByIp(ip.getId()).isEmpty()) {
-          //if the rule is the last one for the ip address assigned to VPC, unassign it from the network
+        
+        //if the rule is the last one for the ip address assigned to VPC, unassign it from the network
+        IpAddress ip = _ipAddressDao.findById(rule.getSourceIpAddressId());
+        if (ip != null && ip.getVpcId() != null && _firewallDao.listByIp(ip.getId()).isEmpty()) {
             _networkMgr.unassignIPFromVpcNetwork(ip.getId());
         }