DaanHoogland commented on code in PR #12407:
URL: https://github.com/apache/cloudstack/pull/12407#discussion_r2689305105
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java:
##########
@@ -1686,7 +1686,7 @@ public boolean
deleteKubernetesCluster(DeleteKubernetesClusterCmd cmd) throws Cl
public static boolean
checkIfVmsAssociatedWithBackupOffering(List<VMInstanceVO> vms) {
for(VMInstanceVO vm : vms) {
- if (Objects.nonNull(vm.getBackupOfferingId())) {
+ if (ObjectUtils.allNotNull(vm, vm.getBackupOfferingId())) {
Review Comment:
@weizhouapache , i tested this and it will give an NPE. the argument
vm.getAccountId() will be evaluated even when vm is null. So I suggest to
replace with `vm != null && vm.getBackupOfferingId() != null`. these are not
equivalent!. evaluation in the expression will stop when `vm` is null but in
`ObjectUtils.allNotNull(..)` all parameters will be evaluated before passing
and thus an NPE will be thrown.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]