You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2014/02/03 13:57:05 UTC

git commit: updated refs/heads/master to f4a96d4

Updated Branches:
  refs/heads/master 9cb37ec34 -> f4a96d4c8


CLOUDSTACK-6011 . When detach is called on a deleted volume, avoid the NPE and throw an appropriate exception instead


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

Branch: refs/heads/master
Commit: f4a96d4c853bd4f60539b9b9e9218b42640652a9
Parents: 9cb37ec
Author: Likitha Shetty <li...@citrix.com>
Authored: Mon Feb 3 17:59:58 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Mon Feb 3 18:17:25 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/storage/VolumeApiServiceImpl.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4a96d4c/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index c856379..6955825 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1382,6 +1382,11 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             volume = _volsDao.findByInstanceAndDeviceId(cmmd.getVirtualMachineId(), cmmd.getDeviceId()).get(0);
         }
 
+        // Check that the volume ID is valid
+        if (volume == null) {
+            throw new InvalidParameterValueException("Unable to find volume with ID: " + volumeId);
+        }
+
         Long vmId = null;
 
         if (cmmd.getVirtualMachineId() == null) {
@@ -1390,11 +1395,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             vmId = cmmd.getVirtualMachineId();
         }
 
-        // Check that the volume ID is valid
-        if (volume == null) {
-            throw new InvalidParameterValueException("Unable to find volume with ID: " + volumeId);
-        }
-
         // Permissions check
         _accountMgr.checkAccess(caller, null, true, volume);