cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [09/50] [abbrv] git commit: updated refs/heads/rbac to 9e92197
Date Tue, 04 Feb 2014 23:38:53 GMT
findbugs: use system account id instead of null (security considerations
to be made here)

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

Branch: refs/heads/rbac
Commit: ee1e8a6c2a375a1a7232f2c7ca2f95f78b3c3d2f
Parents: fef2daf
Author: Daan Hoogland <daan@onecht.net>
Authored: Wed Jan 29 12:36:34 2014 +0100
Committer: Daan Hoogland <daan@onecht.net>
Committed: Wed Jan 29 12:36:34 2014 +0100

----------------------------------------------------------------------
 server/src/com/cloud/storage/VolumeApiServiceImpl.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee1e8a6c/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 55582c6..c856379 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -449,7 +449,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                 volume.setPoolId(null);
                 volume.setDataCenterId(zoneId);
                 volume.setPodId(null);
-                volume.setAccountId((owner == null) ? null : owner.getAccountId());
+                // to prevent a nullpointer deref I put the system account id here when no
owner is given.
+                // TODO Decide if this is valid or whether  throwing a CloudRuntimeException
is more appropriate
+                volume.setAccountId((owner == null) ? Account.ACCOUNT_ID_SYSTEM : owner.getAccountId());
                 volume.setDomainId((owner == null) ? Domain.ROOT_DOMAIN : owner.getDomainId());
                 long diskOfferingId = _diskOfferingDao.findByUniqueName("Cloud.com-Custom").getId();
                 volume.setDiskOfferingId(diskOfferingId);


Mime
View raw message