Program: 48670
Project: 48670
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);
        NodeEntity node=clusterEntityMgr.getNodeByMobId(moId);
        if (node != null) {
          String clusterName=CommonUtil.getClusterName(node.getVmName());
          lockMgr.refreshNodeByMobId(clusterName,moId,null,true);
        }
        break;
      }
case VmDisconnected:
{
      VcVirtualMachine vm=VcCache.getIgnoreMissing(moId);
      if (vm == null) {
        NodeEntity node=clusterEntityMgr.getNodeByMobId(moId);
        if (node != null) {
          String clusterName=CommonUtil.getClusterName(node.getVmName());
          logger.debug("String_Node_Str" + moId + "String_Node_Str");
          lockMgr.removeVmReference(clusterName,moId);
        }
        break;
      }
      if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
        vm.updateRuntime();
        if ((!vm.isConnected()) || vm.getHost().isUnavailbleForManagement()) {
          String clusterName=CommonUtil.getClusterName(vm.getName());
          lockMgr.setNodeConnectionState(clusterName,vm.getName());
          logConnectionChangeEvent(vm.getName());
        }
      }
      break;
    }
case VmPoweredOn:
{
    logger.debug("String_Node_Str");
    refreshNodeWithAction(moId,true,Constants.NODE_ACTION_WAITING_IP,"String_Node_Str");
    if (external) {
      NodePowerOnRequest request=new NodePowerOnRequest(lockMgr,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.warn("String_Node_Str" + ex.getMessage() + "String_Node_Str");
}
break;
}
case VmMigrated:
{
refreshNodeWithAction(moId,false,null,type.name());
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();
String clusterName=CommonUtil.getClusterName(vm.getName());
lockMgr.refreshNodeByVmName(clusterName,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();
String clusterName=CommonUtil.getClusterName(vm.getName());
lockMgr.refreshNodeByVmName(clusterName,moId,vm.getName(),"String_Node_Str",true);
}
break;
}
default :
{
if (external) {
VcVirtualMachine vm=VcCache.getIgnoreMissing(moId);
if (vm == null) {
break;
}
String clusterName=CommonUtil.getClusterName(vm.getName());
lockMgr.refreshNodeByVmName(clusterName,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);
        NodeEntity node=clusterEntityMgr.getNodeByMobId(moId);
        if (node != null) {
          String clusterName=CommonUtil.getClusterName(node.getVmName());
          lockMgr.refreshNodeByMobId(clusterName,moId,null,true);
        }
        break;
      }
case VmDisconnected:
{
      VcVirtualMachine vm=VcCache.getIgnoreMissing(moId);
      if (vm == null) {
        NodeEntity node=clusterEntityMgr.getNodeByMobId(moId);
        if (node != null) {
          String clusterName=CommonUtil.getClusterName(node.getVmName());
          logger.debug("String_Node_Str" + moId + "String_Node_Str");
          lockMgr.removeVmReference(clusterName,moId);
        }
        break;
      }
      if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
        vm.updateRuntime();
        if ((!vm.isConnected()) || vm.getHost().isUnavailbleForManagement()) {
          String clusterName=CommonUtil.getClusterName(vm.getName());
          lockMgr.setNodeConnectionState(clusterName,vm.getName());
          logConnectionChangeEvent(vm.getName());
        }
      }
      break;
    }
case VmPoweredOn:
{
    logger.debug("String_Node_Str");
    if (waitForPowerState(moId,PowerState.poweredOn)) {
      refreshNodeWithAction(moId,true,Constants.NODE_ACTION_WAITING_IP,"String_Node_Str");
      if (external) {
        NodePowerOnRequest request=new NodePowerOnRequest(lockMgr,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:
{
if (waitForPowerState(moId,PowerState.poweredOff)) {
refreshNodeWithAction(moId,true,null,"String_Node_Str");
}
break;
}
case VmConnected:
{
try {
refreshNodeWithAction(moId,false,null,type.name());
}
 catch (AuroraException ex) {
logger.warn("String_Node_Str" + ex.getMessage() + "String_Node_Str");
}
break;
}
case VmMigrated:
{
refreshNodeWithAction(moId,false,null,type.name());
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();
String clusterName=CommonUtil.getClusterName(vm.getName());
lockMgr.refreshNodeByVmName(clusterName,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();
String clusterName=CommonUtil.getClusterName(vm.getName());
lockMgr.refreshNodeByVmName(clusterName,moId,vm.getName(),"String_Node_Str",true);
}
break;
}
default :
{
if (external) {
VcVirtualMachine vm=VcCache.getIgnoreMissing(moId);
if (vm == null) {
break;
}
String clusterName=CommonUtil.getClusterName(vm.getName());
lockMgr.refreshNodeByVmName(clusterName,moId,vm.getName(),true);
}
break;
}
}
}
 catch (ManagedObjectNotFound exp) {
VcUtil.processNotFoundException(exp,moId,logger);
}
}