Skip to content

Commit 4d583a4

Browse files
anshulgangwarrajesh-battala
authored andcommitted
CLOUDSTACK-7932: Fixed wrong semantics for isVmAlive() method in HypervInvestigator
Findbugs will report error on this as it is expecting true/false for Boolean value. But we have diffrent meaning for null so it is false positive case from findbug This closes #39
1 parent 8307dd9 commit 4d583a4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

plugins/hypervisors/hyperv/src/com/cloud/ha/HypervInvestigator.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
*/
1919
package com.cloud.ha;
2020

21+
import java.util.List;
22+
23+
import javax.ejb.Local;
24+
import javax.inject.Inject;
25+
26+
import org.apache.log4j.Logger;
27+
2128
import com.cloud.agent.AgentManager;
2229
import com.cloud.agent.api.Answer;
2330
import com.cloud.agent.api.CheckOnHostCommand;
@@ -28,11 +35,6 @@
2835
import com.cloud.hypervisor.Hypervisor;
2936
import com.cloud.resource.ResourceManager;
3037
import com.cloud.utils.component.AdapterBase;
31-
import org.apache.log4j.Logger;
32-
33-
import javax.ejb.Local;
34-
import javax.inject.Inject;
35-
import java.util.List;
3638

3739
@Local(value=Investigator.class)
3840
public class HypervInvestigator extends AdapterBase implements Investigator {
@@ -45,9 +47,9 @@ public class HypervInvestigator extends AdapterBase implements Investigator {
4547
public Boolean isVmAlive(com.cloud.vm.VirtualMachine vm, Host host) {
4648
Status status = isAgentAlive(host);
4749
if (status == null) {
48-
return false;
50+
return null;
4951
}
50-
return status == Status.Up ? true : false;
52+
return status == Status.Up ? true : null;
5153
}
5254

5355
@Override

0 commit comments

Comments
 (0)