Program: 48783
Project: 48783
Buggy source:
private void processEvent(VcEventType type,Event e,String moId,boolean external) throws Exception {
  try {
switch (type) {
case VmRemoved:
{
        logger.debug("String_Node_Str" + moId);
        if (clusterEntityMgr.getNodeByMobId(moId) != null) {
          clusterEntityMgr.refreshNodeByMobId(moId,null,true);
        }
        break;
      }
case VmDisconnected:
{
      VcVirtualMachine vm=VcCache.getIgnoreMissing(e.getVm().getVm());
      if (vm == null) {
        if (clusterEntityMgr.getNodeByMobId(moId) != null) {
          logger.debug("String_Node_Str" + moId + "String_Node_Str");
          clusterEntityMgr.removeVmReference(moId);
        }
        break;
      }
      if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
        vm.updateRuntime();
        if ((!vm.isConnected()) || vm.getHost().isUnavailbleForManagement()) {
          clusterEntityMgr.setNodeConnectionState(vm.getName());
          logConnectionChangeEvent(vm.getName());
        }
      }
      break;
    }
case VmPoweredOn:
{
    refreshNodeWithAction(e,moId,true,Constants.NODE_ACTION_WAITING_IP,"String_Node_Str");
    if (external) {
      NodePowerOnRequest request=new NodePowerOnRequest(clusterEntityMgr,moId);
      CmsWorker.addRequest(WorkQueue.VC_TASK_NO_DELAY,request);
    }
    break;
  }
case VmCloned:
{
  refreshNodeWithAction(e,moId,true,Constants.NODE_ACTION_RECONFIGURE,"String_Node_Str");
  break;
}
case VmSuspended:
{
refreshNodeWithAction(e,moId,true,null,"String_Node_Str");
break;
}
case VmPoweredOff:
{
refreshNodeWithAction(e,moId,true,null,"String_Node_Str");
break;
}
case VmConnected:
{
try {
refreshNodeWithAction(e,moId,false,null,type.name());
}
 catch (AuroraException ex) {
logger.error("String_Node_Str" + ex.getMessage() + "String_Node_Str");
}
break;
}
case VhmError:
case VhmWarning:
{
EventEx event=(EventEx)e;
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
break;
}
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + event.getEventTypeId() + "String_Node_Str"+ vm.getName()+ "String_Node_Str"+ event.getMessage());
vm.updateRuntime();
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),event.getMessage(),true);
}
break;
}
case VhmInfo:
{
EventEx event=(EventEx)e;
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
break;
}
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + event.getEventTypeId() + "String_Node_Str"+ vm.getName()+ "String_Node_Str"+ event.getMessage());
vm.updateRuntime();
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),"String_Node_Str",true);
}
break;
}
default :
{
if (external) {
VcVirtualMachine vm=VcCache.getIgnoreMissing(moId);
if (vm == null) {
break;
}
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),true);
}
break;
}
}
}
 catch (ManagedObjectNotFound exp) {
VcUtil.processNotFoundException(exp,moId,logger);
}
}

Fixed version (ground truth):
private void processEvent(VcEventType type,Event e,String moId,boolean external) throws Exception {
  try {
switch (type) {
case VmRemoved:
{
        logger.debug("String_Node_Str" + moId);
        if (clusterEntityMgr.getNodeByMobId(moId) != null) {
          clusterEntityMgr.refreshNodeByMobId(moId,null,true);
        }
        break;
      }
case VmDisconnected:
{
      VcVirtualMachine vm=VcCache.getIgnoreMissing(moId);
      if (vm == null) {
        if (clusterEntityMgr.getNodeByMobId(moId) != null) {
          logger.debug("String_Node_Str" + moId + "String_Node_Str");
          clusterEntityMgr.removeVmReference(moId);
        }
        break;
      }
      if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
        vm.updateRuntime();
        if ((!vm.isConnected()) || vm.getHost().isUnavailbleForManagement()) {
          clusterEntityMgr.setNodeConnectionState(vm.getName());
          logConnectionChangeEvent(vm.getName());
        }
      }
      break;
    }
case VmPoweredOn:
{
    refreshNodeWithAction(moId,true,Constants.NODE_ACTION_WAITING_IP,"String_Node_Str");
    if (external) {
      NodePowerOnRequest request=new NodePowerOnRequest(clusterEntityMgr,moId);
      CmsWorker.addRequest(WorkQueue.VC_TASK_NO_DELAY,request);
    }
    break;
  }
case VmCloned:
{
  refreshNodeWithAction(moId,true,Constants.NODE_ACTION_RECONFIGURE,"String_Node_Str");
  break;
}
case VmSuspended:
{
refreshNodeWithAction(moId,true,null,"String_Node_Str");
break;
}
case VmPoweredOff:
{
refreshNodeWithAction(moId,true,null,"String_Node_Str");
break;
}
case VmConnected:
{
try {
refreshNodeWithAction(moId,false,null,type.name());
}
 catch (AuroraException ex) {
logger.error("String_Node_Str" + ex.getMessage() + "String_Node_Str");
}
break;
}
case VhmError:
case VhmWarning:
{
EventEx event=(EventEx)e;
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
break;
}
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + event.getEventTypeId() + "String_Node_Str"+ vm.getName()+ "String_Node_Str"+ event.getMessage());
vm.updateRuntime();
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),event.getMessage(),true);
}
break;
}
case VhmInfo:
{
EventEx event=(EventEx)e;
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
break;
}
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + event.getEventTypeId() + "String_Node_Str"+ vm.getName()+ "String_Node_Str"+ event.getMessage());
vm.updateRuntime();
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),"String_Node_Str",true);
}
break;
}
default :
{
if (external) {
VcVirtualMachine vm=VcCache.getIgnoreMissing(moId);
if (vm == null) {
break;
}
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),true);
}
break;
}
}
}
 catch (ManagedObjectNotFound exp) {
VcUtil.processNotFoundException(exp,moId,logger);
}
}