Program: 14994
Project: 14994
Buggy source:
private static void updateVmInstance(final String originCluster,final VmInfo runVm){
  VmState state=VmState.Mapper.get(runVm.getStateName());
  VmInstance vm=null;
  try {
    vm=VmInstances.lookup(runVm.getInstanceId());
  }
 catch (  NoSuchElementException e) {
    try {
      vm=VmInstances.lookupDisabled(runVm.getInstanceId());
      if (!VmState.BURIED.equals(vm.getRuntimeState()) && vm.getSplitTime() > VmInstances.BURY_TIME) {
        vm.setState(VmState.BURIED,Reason.BURIED);
      }
      return;
    }
 catch (    NoSuchElementException e1) {
      if ((VmState.PENDING.equals(state) || VmState.RUNNING.equals(state))) {
        SystemState.restoreInstance(originCluster,runVm);
      }
      return;
    }
  }
  long splitTime=vm.getSplitTime();
  VmState oldState=vm.getRuntimeState();
  vm.setServiceTag(runVm.getServiceTag());
  vm.setPlatform(runVm.getPlatform());
  vm.setBundleTaskState(runVm.getBundleTaskStateName());
  if (VmState.SHUTTING_DOWN.equals(vm.getRuntimeState()) && splitTime > VmInstances.SHUT_DOWN_TIME) {
    vm.setState(VmState.TERMINATED,Reason.EXPIRED);
  }
 else   if (VmState.STOPPING.equals(vm.getRuntimeState()) && splitTime > VmInstances.SHUT_DOWN_TIME) {
    vm.setState(VmState.STOPPED,Reason.EXPIRED);
  }
 else   if (VmState.STOPPING.equals(vm.getRuntimeState()) && VmState.SHUTTING_DOWN.equals(VmState.Mapper.get(runVm.getStateName()))) {
    vm.setState(VmState.STOPPED,Reason.APPEND,"String_Node_Str");
  }
 else   if (VmState.SHUTTING_DOWN.equals(vm.getRuntimeState()) && VmState.SHUTTING_DOWN.equals(VmState.Mapper.get(runVm.getStateName()))) {
    vm.setState(VmState.TERMINATED,Reason.APPEND,"String_Node_Str");
  }
 else   if ((VmState.PENDING.equals(state) || VmState.RUNNING.equals(state)) && (VmState.PENDING.equals(vm.getRuntimeState()) || VmState.RUNNING.equals(vm.getRuntimeState()))) {
    if (!VmInstance.DEFAULT_IP.equals(runVm.getNetParams().getIpAddress())) {
      vm.updateAddresses(runVm.getNetParams().getIpAddress(),runVm.getNetParams().getIgnoredPublicIp());
    }
    vm.setState(VmState.Mapper.get(runVm.getStateName()),Reason.APPEND,"String_Node_Str");
    vm.updateNetworkIndex(runVm.getNetParams().getNetworkIndex());
    vm.updateVolumeAttachments(runVm.getVolumes());
    try {
      NetworkGroup network=Networks.getInstance().lookup(runVm.getOwnerId() + "String_Node_Str" + runVm.getGroupNames().get(0));
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
private static void updateVmInstance(final String originCluster,final VmInfo runVm){
  VmState state=VmState.Mapper.get(runVm.getStateName());
  VmInstance vm=null;
  try {
    vm=VmInstances.lookup(runVm.getInstanceId());
  }
 catch (  NoSuchElementException e) {
    try {
      vm=VmInstances.lookupDisabled(runVm.getInstanceId());
      if (!VmState.BURIED.equals(vm.getRuntimeState()) && vm.getSplitTime() > VmInstances.BURY_TIME) {
        vm.setState(VmState.BURIED,Reason.BURIED);
      }
      return;
    }
 catch (    NoSuchElementException e1) {
      if ((VmState.PENDING.equals(state) || VmState.RUNNING.equals(state))) {
        SystemState.restoreInstance(originCluster,runVm);
      }
      return;
    }
  }
  long splitTime=vm.getSplitTime();
  VmState oldState=vm.getRuntimeState();
  vm.setServiceTag(runVm.getServiceTag());
  vm.setPlatform(runVm.getPlatform());
  vm.setBundleTaskState(runVm.getBundleTaskStateName());
  if (VmState.SHUTTING_DOWN.equals(vm.getRuntimeState()) && splitTime > VmInstances.SHUT_DOWN_TIME) {
    vm.setState(VmState.TERMINATED,Reason.EXPIRED);
  }
 else   if (VmState.STOPPING.equals(vm.getRuntimeState()) && splitTime > VmInstances.SHUT_DOWN_TIME) {
    vm.setState(VmState.STOPPED,Reason.EXPIRED);
  }
 else   if (VmState.STOPPING.equals(vm.getRuntimeState()) && VmState.SHUTTING_DOWN.equals(VmState.Mapper.get(runVm.getStateName()))) {
    vm.setState(VmState.STOPPED,Reason.APPEND,"String_Node_Str");
  }
 else   if (VmState.SHUTTING_DOWN.equals(vm.getRuntimeState()) && VmState.SHUTTING_DOWN.equals(VmState.Mapper.get(runVm.getStateName()))) {
    vm.setState(VmState.TERMINATED,Reason.APPEND,"String_Node_Str");
  }
 else   if ((VmState.PENDING.equals(state) || VmState.RUNNING.equals(state)) && (VmState.PENDING.equals(vm.getRuntimeState()) || VmState.RUNNING.equals(vm.getRuntimeState()))) {
    if (!VmInstance.DEFAULT_IP.equals(runVm.getNetParams().getIpAddress())) {
      vm.updateAddresses(runVm.getNetParams().getIpAddress(),runVm.getNetParams().getIgnoredPublicIp());
    }
    vm.setState(VmState.Mapper.get(runVm.getStateName()),Reason.APPEND,"String_Node_Str");
    vm.updateVolumeAttachments(runVm.getVolumes());
    try {
      NetworkGroup network=Networks.getInstance().lookup(runVm.getOwnerId() + "String_Node_Str" + runVm.getGroupNames().get(0));
    }
 catch (    Exception e) {
    }
  }
}