You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/04/17 16:17:20 UTC

[GitHub] khos2ow commented on a change in pull request #2577: Prevent NPE if guest OS mapping is missing while prioritizing hosts

khos2ow 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_r182139455
 
 

 ##########
 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:
   Technically `templateGuestOSCategory == null` would be enough, and I cannot think of a way `getTemplateGuestOSCategory` returning empty string unless the database record integrity has been changed, that's why I used `Strings.isNullOrEmpty` rather rather than a simple `== null` check. (which might be slightly overkill at the same time!)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services