From 6704ef2794cf7617da658ab0a96f6aca9eb3134c Mon Sep 17 00:00:00 2001 From: "Rodrigo D. Lopez" Date: Thu, 13 Aug 2020 06:05:23 -0400 Subject: [PATCH] server: fix comparison using nullable objects (#4256) This PR fix some wrongs comparison using nullable objects. Preventing null pointer exception --- .../src/main/java/com/cloud/storage/VolumeApiServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java index 14eb01329fe..dc90c37d2a7 100644 --- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java @@ -2199,7 +2199,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic // OfflineVmwareMigration: check storage tags on disk(offering)s in comparison to destination storage pool // OfflineVmwareMigration: if no match return a proper error now DiskOfferingVO diskOffering = _diskOfferingDao.findById(vol.getDiskOfferingId()); - if (diskOffering.equals(null)) { + if (diskOffering == null) { throw new CloudRuntimeException("volume '" + vol.getUuid() + "', has no diskoffering. Migration target cannot be checked."); } if (!doesTargetStorageSupportDiskOffering(destPool, diskOffering)) {