From d1700606ddc923a6c606377c49618d7d566981a2 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Fri, 22 Jun 2012 15:06:09 -0700 Subject: [PATCH] VPC: fixed NPE in network ACL delete (ip address is null for the rule of this type_ --- .../cloud/network/firewall/FirewallManagerImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java index 62901df5022..7d0a78581d9 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()); }