Sharad Mishra has uploaded a new change for review. Change subject: core: fix NPE in canDoAction at AttachDisk. ......................................................................
core: fix NPE in canDoAction at AttachDisk. If disk is null, then the method should return instead of proceeding further as it could lead to NPE when disk is accessed. Change-Id: If1cb0a34c663b2b069eca92ad5229041525ba56e Signed-off-by: Sharad Mishra <snmis...@linux.vnet.ibm.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/7848/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java index 9261e7b..a675f92 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java @@ -53,8 +53,8 @@ protected boolean canDoAction() { boolean retValue = true; if (disk == null) { - retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); + return false; } boolean isImageDisk = disk.getDiskStorageType() == DiskStorageType.IMAGE; if (isImageDisk && ((DiskImage) disk).getimageStatus() == ImageStatus.ILLEGAL) { @@ -62,7 +62,7 @@ return false; } retValue = - retValue && acquireLockInternal() && isVmExist() && isVmUpOrDown() && isDiskCanBeAddedToVm(disk) + acquireLockInternal() && isVmExist() && isVmUpOrDown() && isDiskCanBeAddedToVm(disk) && isDiskPassPCIAndIDELimit(disk); if (retValue && getVmDeviceDao().exists(new VmDeviceId(disk.getId(), getVmId()))) { retValue = false; -- To view, visit http://gerrit.ovirt.org/7848 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If1cb0a34c663b2b069eca92ad5229041525ba56e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Sharad Mishra <snmis...@linux.vnet.ibm.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches