Program: 105378
Project: 105378
Buggy source:
@Override public Boolean isVmAlive(VirtualMachine vm,Host host){
  if (!vm.getType().isUsedBySystem()) {
    s_logger.debug("String_Node_Str" + vm + "String_Node_Str");
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vm + "String_Node_Str");
  }
  if (vm.getHostId() == null) {
    s_logger.debug("String_Node_Str" + vm);
    return null;
  }
  HostVO vmHost=_hostDao.findById(vm.getHostId());
  if (vmHost == null) {
    s_logger.debug("String_Node_Str" + vm.getHostId());
    return null;
  }
  List<? extends Nic> nics=_networkMgr.getNicsForTraffic(vm.getId(),TrafficType.Management);
  if (nics.size() == 0) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + vm + "String_Node_Str");
    }
    return null;
  }
  for (  Nic nic : nics) {
    if (nic.getIp4Address() == null) {
      continue;
    }
    List<Long> otherHosts=findHostByPod(vmHost.getPodId(),vm.getHostId());
    for (    Long otherHost : otherHosts) {
      Status vmState=testIpAddress(otherHost,nic.getIp4Address());
      if (vmState == null) {
        continue;
      }
      if (vmState == Status.Up) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + vm.getPrivateIpAddress() + "String_Node_Str");
        }
        return Boolean.TRUE;
      }
 else       if (vmState == Status.Down) {
        Status vmHostState=testIpAddress(otherHost,vmHost.getPrivateIpAddress());
        if ((vmHostState != null) && (vmHostState == Status.Up)) {
          if (s_logger.isDebugEnabled()) {
            s_logger.debug("String_Node_Str" + vmHost.getPrivateIpAddress() + "String_Node_Str");
          }
          return Boolean.FALSE;
        }
      }
    }
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vm + "String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
@Override public boolean isVmAlive(VirtualMachine vm,Host host) throws UnknownVM {
  if (!vm.getType().isUsedBySystem()) {
    s_logger.debug("String_Node_Str" + vm + "String_Node_Str");
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vm + "String_Node_Str");
  }
  if (vm.getHostId() == null) {
    s_logger.debug("String_Node_Str" + vm);
    throw new UnknownVM();
  }
  HostVO vmHost=_hostDao.findById(vm.getHostId());
  if (vmHost == null) {
    s_logger.debug("String_Node_Str" + vm.getHostId());
    throw new UnknownVM();
  }
  List<? extends Nic> nics=_networkMgr.getNicsForTraffic(vm.getId(),TrafficType.Management);
  if (nics.size() == 0) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + vm + "String_Node_Str");
    }
    throw new UnknownVM();
  }
  for (  Nic nic : nics) {
    if (nic.getIp4Address() == null) {
      continue;
    }
    List<Long> otherHosts=findHostByPod(vmHost.getPodId(),vm.getHostId());
    for (    Long otherHost : otherHosts) {
      Status vmState=testIpAddress(otherHost,nic.getIp4Address());
      if (vmState == null) {
        continue;
      }
      if (vmState == Status.Up) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug("String_Node_Str" + vm.getPrivateIpAddress() + "String_Node_Str");
        }
        return Boolean.TRUE;
      }
 else       if (vmState == Status.Down) {
        Status vmHostState=testIpAddress(otherHost,vmHost.getPrivateIpAddress());
        if ((vmHostState != null) && (vmHostState == Status.Up)) {
          if (s_logger.isDebugEnabled()) {
            s_logger.debug("String_Node_Str" + vmHost.getPrivateIpAddress() + "String_Node_Str");
          }
          return Boolean.FALSE;
        }
      }
    }
  }
  if (s_logger.isDebugEnabled()) {
    s_logger.debug("String_Node_Str" + vm + "String_Node_Str");
  }
  throw new UnknownVM();
}