cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/2] git commit: updated refs/heads/master to a5004e3
Date Wed, 17 Sep 2014 08:40:41 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 65608e994 -> a5004e37a


CID-1233086: Fix potential NPE blowup in UserVmManagerImpl

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/master
Commit: bdee5e37343f6f4e5be2acd6cbc6e172e0d1fe36
Parents: 65608e9
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Wed Sep 17 10:32:23 2014 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Sep 17 10:32:23 2014 +0200

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bdee5e37/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index b3252db..2636096 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2544,7 +2544,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
                     s_logger.debug("Creating network for account " + owner + " from the network
offering id=" + requiredOfferings.get(0).getId() + " as a part of deployVM process");
                     Network newNetwork = _networkMgr.createGuestNetwork(requiredOfferings.get(0).getId(),
owner.getAccountName() + "-network", owner.getAccountName() + "-network",
                             null, null, null, null, owner, null, physicalNetwork, zone.getId(),
ACLType.Account, null, null, null, null, true, null);
-                    defaultNetwork = _networkDao.findById(newNetwork.getId());
+                    if (newNetwork != null) {
+                        defaultNetwork = _networkDao.findById(newNetwork.getId());
+                    }
                 } else if (virtualNetworks.size() > 1) {
                     throw new InvalidParameterValueException("More than 1 default Isolated
networks are found for account " + owner + "; please specify networkIds");
                 } else {
@@ -2554,7 +2556,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
                 throw new InvalidParameterValueException("Required network offering id="
+ requiredOfferings.get(0).getId() + " is not in " + NetworkOffering.State.Enabled);
             }
 
-            networkList.add(defaultNetwork);
+            if (defaultNetwork != null) {
+                networkList.add(defaultNetwork);
+            }
 
         } else {
             for (Long networkId : networkIdList) {


Mime
View raw message