CLOUDSTACK-6712: NPE in findJobInstanceUuid() in ApiDBUtils

This commit is contained in:
Murali Reddy 2014-05-20 10:21:01 +05:30
parent ef2012677c
commit 965346cad1

View File

@ -1442,6 +1442,12 @@ public class ApiDBUtils {
String jobInstanceId = null;
ApiCommandJobType jobInstanceType = EnumUtils.fromString(ApiCommandJobType.class, job.getInstanceType(), ApiCommandJobType.None);
if (job.getInstanceId() == null) {
// when assert is hit, implement 'getInstanceId' of BaseAsyncCmd and return appropriate instance id
assert (false);
return null;
}
if (jobInstanceType == ApiCommandJobType.Volume) {
VolumeVO volume = ApiDBUtils.findVolumeById(job.getInstanceId());
if (volume != null) {