Prevent NPE if guest OS mapping is missing while prioritizing hosts - #2577
Conversation
|
@khos2ow a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
| // Determine the guest OS category of the template | ||
| String templateGuestOSCategory = getTemplateGuestOSCategory(template); | ||
|
|
||
| if (Strings.isNullOrEmpty(templateGuestOSCategory)) { |
There was a problem hiding this 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.
There was a problem hiding this 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!)
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1938 |
|
@khos2ow can you change base branch to 4.11? |
82b7c2e to
26b8041
Compare
|
@rhtyd done. |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✖centos7 ✖debian. JID-1952 |
|
sorry for merging this. I did not check the integration tests. hope i will be forgiven one day. |
|
LGTM, given the changes on discretion I'm okay to accept/merge this as travis passed. |
Description
When starting an existing VM and trying to prioritize hosts, if Guest OS mapping has been removed from that host, there will be a NullPointerException which prevents the VM to be started successfully.
Types of changes
GitHub Issue/PRs
Screenshots (if appropriate):
How Has This Been Tested?
Checklist:
Testing
@blueorangutan package