Repository: cloudstack Updated Branches: refs/heads/master d8f37c5e1 -> 1f09b8c3b
Fixed Coverity issue "Dereference null return value" added a not null check and a CloudRuntimeException in case of null Signed-off-by: Rajani Karuturi <[email protected]> This closes #617 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1f09b8c3 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1f09b8c3 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1f09b8c3 Branch: refs/heads/master Commit: 1f09b8c3bfdfee559d1735c8796daae16bf19e74 Parents: d8f37c5 Author: Maneesha P <[email protected]> Authored: Thu Jul 23 00:45:00 2015 +0530 Committer: Rajani Karuturi <[email protected]> Committed: Thu Jul 23 15:46:17 2015 +0530 ---------------------------------------------------------------------- .../wrapper/LibvirtBackupSnapshotCommandWrapper.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f09b8c3/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtBackupSnapshotCommandWrapper.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtBackupSnapshotCommandWrapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtBackupSnapshotCommandWrapper.java index 25da046..ad33945 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtBackupSnapshotCommandWrapper.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtBackupSnapshotCommandWrapper.java @@ -171,7 +171,11 @@ public final class LibvirtBackupSnapshotCommandWrapper extends CommandWrapper<Ba final String snapshot = snapshotXML.format(args); s_logger.debug(snapshot); final DomainSnapshot snap = vm.snapshotLookupByName(snapshotName); - snap.delete(0); + if (snap != null) { + snap.delete(0); + } else { + throw new CloudRuntimeException("Unable to find vm snapshot with name -" + snapshotName); + } /* * libvirt on RHEL6 doesn't handle resume event emitted from @@ -203,4 +207,4 @@ public final class LibvirtBackupSnapshotCommandWrapper extends CommandWrapper<Ba } return new BackupSnapshotAnswer(command, true, null, snapshotRelPath + File.separator + snapshotName, true); } -} \ No newline at end of file +}
