cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [2/2] git commit: updated refs/heads/master to a5004e3
Date Wed, 17 Sep 2014 08:40:42 GMT
CID-1233084: Fix NPE in persisting volume in VolumeApiServiceImpl

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/a5004e37
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a5004e37
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a5004e37

Branch: refs/heads/master
Commit: a5004e37ad4609b98e5d5a78452e6fb8858f6504
Parents: bdee5e3
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Wed Sep 17 10:39:53 2014 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Sep 17 10:39:53 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5004e37/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 16d46e6..cf18555 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -343,8 +343,11 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                 volume.setDomainId((owner == null) ? Domain.ROOT_DOMAIN : owner.getDomainId());
 
                 if (diskOfferingId == null) {
-                    long defaultDiskOfferingId = _diskOfferingDao.findByUniqueName("Cloud.com-Custom").getId();
-                    volume.setDiskOfferingId(defaultDiskOfferingId);
+                    DiskOfferingVO diskOfferingVO = _diskOfferingDao.findByUniqueName("Cloud.com-Custom");
+                    if (diskOfferingVO != null) {
+                        long defaultDiskOfferingId = diskOfferingVO.getId();
+                        volume.setDiskOfferingId(defaultDiskOfferingId);
+                    }
                 } else {
                     volume.setDiskOfferingId(diskOfferingId);
                 }


Mime
View raw message