This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch 4.16
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.16 by this push:
     new 8ba5b92  server: Fix NPE while deleting a domain (#5753)
8ba5b92 is described below

commit 8ba5b92a83aefef05a76a072f6b4961c69e51845
Author: Rakesh <[email protected]>
AuthorDate: Mon Dec 27 20:51:43 2021 +0100

    server: Fix NPE while deleting a domain (#5753)
    
    * server: Fix NPE while deleting a domain
    
    While deleting a domain, if vlan ip range cant be found
    then this will throw NPE. Just return false if vlan ip
    range cant be found
    
    * return true if vlan is not found
    
    * change output message
    
    Co-authored-by: Rakesh Venkatesh <[email protected]>
---
 .../com/cloud/configuration/ConfigurationManagerImpl.java   | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java 
b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
index bea9cd0..1380621 100755
--- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -4922,7 +4922,10 @@ public class ConfigurationManagerImpl extends 
ManagerBase implements Configurati
     public boolean releasePublicIpRange(final long vlanDbId, final long 
userId, final Account caller) {
         VlanVO vlan = _vlanDao.findById(vlanDbId);
         if(vlan == null) {
-            s_logger.warn("VLAN information for Account '" + caller + "', User 
'" + userId + "' VLAN '" + vlanDbId + "' is null. This is NPE situation.");
+            // Nothing to do if vlan can't be found
+            s_logger.warn(String.format("Skipping the process for releasing 
public IP range as could not find a VLAN with ID '%s' for Account '%s' and User 
'%s'."
+                    ,vlanDbId, caller, userId));
+            return true;
         }
 
         // Verify range is dedicated
@@ -4989,13 +4992,15 @@ public class ConfigurationManagerImpl extends 
ManagerBase implements Configurati
             }
             // decrement resource count for dedicated public ip's
             
_resourceLimitMgr.decrementResourceCount(acctVln.get(0).getAccountId(), 
ResourceType.public_ip, new Long(ips.size()));
-            return true;
+            success = true;
         } else if (isDomainSpecific && 
_domainVlanMapDao.remove(domainVlan.get(0).getId())) {
             s_logger.debug("Remove the vlan from domain_vlan_map 
successfully.");
-            return true;
+            success = true;
         } else {
-            return false;
+            success = false;
         }
+
+        return success;
     }
 
     @DB

Reply via email to