Program: 48978
Project: 48978
Buggy source:
public VcEventProcessor(final ClusterEntityManager clusterEntityMgr){
  VcEventListener.installExtEventHandler(vmEvents,new IVcEventHandler(){
    @Override public boolean eventHandler(    VcEventType type,    Event e) throws Exception {
      AuAssert.check(e instanceof VmEvent || e instanceof EventEx);
      ManagedObjectReference moRef=e.getVm().getVm();
      String moId=MoUtil.morefToString(moRef);
      logger.debug("String_Node_Str" + e);
switch (type) {
case VmRemoved:
{
          logger.debug("String_Node_Str" + moId);
          if (clusterEntityMgr.getNodeByMobId(moId) != null) {
            clusterEntityMgr.refreshNodeByMobId(moId,null,true);
          }
          return false;
        }
case VmPoweredOn:
{
        VmPoweredOnEvent event=(VmPoweredOnEvent)e;
        e.getVm();
        VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
        if (vm == null) {
          return false;
        }
        vm.updateRuntime();
        if (clusterEntityMgr.getNodeByMobId(moId) != null) {
          logger.info("String_Node_Str" + vm.getName());
          clusterEntityMgr.refreshNodeByMobId(moId,Constants.NODE_ACTION_WAITING_IP,true);
          NodePowerOnRequest request=new NodePowerOnRequest(clusterEntityMgr,moId);
          CmsWorker.addRequest(WorkQueue.VC_TASK_NO_DELAY,request);
        }
        break;
      }
case VmPoweredOff:
{
      VmPoweredOffEvent event=(VmPoweredOffEvent)e;
      VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
      if (vm == null) {
        return false;
      }
      vm.updateRuntime();
      if (clusterEntityMgr.getNodeByMobId(moId) != null) {
        logger.info("String_Node_Str" + vm.getName());
        clusterEntityMgr.refreshNodeByMobId(moId,null,true);
      }
      break;
    }
case VmSuspended:
{
    VmSuspendedEvent event=(VmSuspendedEvent)e;
    VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
    if (vm == null) {
      return false;
    }
    vm.updateRuntime();
    if (clusterEntityMgr.getNodeByMobId(moId) != null) {
      logger.info("String_Node_Str" + vm.getName());
      clusterEntityMgr.refreshNodeByMobId(moId,null,true);
    }
    break;
  }
}
VcCache.refreshAll(moRef);
return false;
}
}
);
VcEventListener.installEventHandler(vmEvents,new IVcEventHandler(){
@Override public boolean eventHandler(VcEventType type,Event e) throws Exception {
AuAssert.check(e instanceof VmEvent || e instanceof EventEx);
ManagedObjectReference moRef=e.getVm().getVm();
String moId=MoUtil.morefToString(moRef);
logger.debug("String_Node_Str" + e);
switch (type) {
case VmRemoved:
{
  logger.debug("String_Node_Str" + moId);
  if (clusterEntityMgr.getNodeByMobId(moId) != null) {
    clusterEntityMgr.refreshNodeByMobId(moId,null,true);
  }
  return false;
}
case VmPoweredOn:
{
VmPoweredOnEvent event=(VmPoweredOnEvent)e;
e.getVm();
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
  return false;
}
vm.updateRuntime();
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
  logger.info("String_Node_Str" + vm.getName());
  clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),Constants.NODE_ACTION_WAITING_IP,true);
}
break;
}
case VmCloned:
{
VmClonedEvent event=(VmClonedEvent)e;
e.getVm();
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
return false;
}
vm.updateRuntime();
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + vm.getName());
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),Constants.NODE_ACTION_RECONFIGURE,true);
}
break;
}
case VmSuspended:
{
VmSuspendedEvent event=(VmSuspendedEvent)e;
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
return false;
}
vm.updateRuntime();
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + vm.getName());
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),null,true);
}
break;
}
case VmPoweredOff:
{
VmPoweredOffEvent event=(VmPoweredOffEvent)e;
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
return false;
}
vm.updateRuntime();
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + vm.getName());
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),null,true);
}
break;
}
}
return false;
}
}
);
}

Fixed version (ground truth):
public VcEventProcessor(final ClusterEntityManager clusterEntityMgr){
  VcEventListener.installExtEventHandler(vmEvents,new IVcEventHandler(){
    @Override public boolean eventHandler(    VcEventType type,    Event e) throws Exception {
      AuAssert.check(e instanceof VmEvent || e instanceof EventEx);
      ManagedObjectReference moRef=e.getVm().getVm();
      String moId=MoUtil.morefToString(moRef);
      logger.debug("String_Node_Str" + e);
switch (type) {
case VmRemoved:
{
          logger.debug("String_Node_Str" + moId);
          if (clusterEntityMgr.getNodeByMobId(moId) != null) {
            clusterEntityMgr.refreshNodeByMobId(moId,null,true);
          }
          return false;
        }
case VmPoweredOn:
{
        VmPoweredOnEvent event=(VmPoweredOnEvent)e;
        e.getVm();
        VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
        if (vm == null) {
          return false;
        }
        vm.updateRuntime();
        if (clusterEntityMgr.getNodeByMobId(moId) != null) {
          logger.info("String_Node_Str" + vm.getName());
          clusterEntityMgr.refreshNodeByMobId(moId,Constants.NODE_ACTION_WAITING_IP,true);
          NodePowerOnRequest request=new NodePowerOnRequest(clusterEntityMgr,moId);
          CmsWorker.addRequest(WorkQueue.VC_TASK_NO_DELAY,request);
        }
        break;
      }
case VmPoweredOff:
{
      VmPoweredOffEvent event=(VmPoweredOffEvent)e;
      VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
      if (vm == null) {
        return false;
      }
      vm.updateRuntime();
      if (clusterEntityMgr.getNodeByMobId(moId) != null) {
        logger.info("String_Node_Str" + vm.getName());
        clusterEntityMgr.refreshNodeByMobId(moId,null,true);
      }
      break;
    }
case VmSuspended:
{
    VmSuspendedEvent event=(VmSuspendedEvent)e;
    VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
    if (vm == null) {
      return false;
    }
    vm.updateRuntime();
    if (clusterEntityMgr.getNodeByMobId(moId) != null) {
      logger.info("String_Node_Str" + vm.getName());
      clusterEntityMgr.refreshNodeByMobId(moId,null,true);
    }
    break;
  }
}
VcCache.refreshAll(moRef);
return false;
}
}
);
VcEventListener.installEventHandler(vmEvents,new IVcEventHandler(){
@Override public boolean eventHandler(VcEventType type,Event e) throws Exception {
AuAssert.check(e instanceof VmEvent || e instanceof EventEx);
ManagedObjectReference moRef=e.getVm().getVm();
String moId=MoUtil.morefToString(moRef);
logger.debug("String_Node_Str" + e);
switch (type) {
case VmRemoved:
{
  logger.debug("String_Node_Str" + moId);
  if (clusterEntityMgr.getNodeByMobId(moId) != null) {
    clusterEntityMgr.refreshNodeByMobId(moId,null,true);
  }
  return false;
}
case VmPoweredOn:
{
VmPoweredOnEvent event=(VmPoweredOnEvent)e;
e.getVm();
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
  return false;
}
vm.updateRuntime();
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
  logger.info("String_Node_Str" + vm.getName());
  clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),Constants.NODE_ACTION_WAITING_IP,true);
}
break;
}
case VmCloned:
{
VmClonedEvent event=(VmClonedEvent)e;
e.getVm();
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
return false;
}
vm.updateRuntime();
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + vm.getName());
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),Constants.NODE_ACTION_WAITING,true);
}
break;
}
case VmSuspended:
{
VmSuspendedEvent event=(VmSuspendedEvent)e;
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
return false;
}
vm.updateRuntime();
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + vm.getName());
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),null,true);
}
break;
}
case VmPoweredOff:
{
VmPoweredOffEvent event=(VmPoweredOffEvent)e;
VcVirtualMachine vm=VcCache.getIgnoreMissing(event.getVm().getVm());
if (vm == null) {
return false;
}
vm.updateRuntime();
if (clusterEntityMgr.getNodeByVmName(vm.getName()) != null) {
logger.info("String_Node_Str" + vm.getName());
clusterEntityMgr.refreshNodeByVmName(moId,vm.getName(),null,true);
}
break;
}
}
return false;
}
}
);
}