Updated Branches: refs/heads/master fef2daf5d -> ee1e8a6c2
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/master Commit: ee1e8a6c2a375a1a7232f2c7ca2f95f78b3c3d2f Parents: fef2daf Author: Daan Hoogland <d...@onecht.net> Authored: Wed Jan 29 12:36:34 2014 +0100 Committer: Daan Hoogland <d...@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);