rafaelweingartner commented on a change in pull request #2577: Prevent NPE if 
guest OS mapping is missing while prioritizing hosts
URL: https://github.com/apache/cloudstack/pull/2577#discussion_r182134818
 
 

 ##########
 File path: 
server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java
 ##########
 @@ -417,6 +419,10 @@ public boolean isVirtualMachineUpgradable(VirtualMachine 
vm, ServiceOffering off
         // Determine the guest OS category of the template
         String templateGuestOSCategory = getTemplateGuestOSCategory(template);
 
+        if (Strings.isNullOrEmpty(templateGuestOSCategory)) {
 
 Review comment:
   if you return a `null` value in `getTemplateGuestOSCategory` method, why not 
simply check `templateGuestOSCategory == null`?
   
   Is it possible to have an empty or blank `guestOSCategory.name`? 
   BTW: `Strings.isNullOrEmpty` will return `false` for blanks.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to