Program: 14518
Project: 14518
Buggy source:
/** 
 * @return
 */
public Predicate<VmInfo> doUpdate(){
  return new Predicate<VmInfo>(){
    @Override public boolean apply(    final VmInfo runVm){
      if (!Entities.isPersistent(VmInstance.this)) {
        throw new TransientEntityException(this.toString());
      }
 else {
        final EntityTransaction db=Entities.get(VmInstance.class);
        try {
          final VmState runVmState=VmState.Mapper.get(runVm.getStateName());
          if (VmInstance.this.getRuntimeState().isBundling()) {
            final BundleState bundleState=BundleState.mapper.apply(runVm.getBundleTaskStateName());
            VmInstance.this.getRuntimeState().updateBundleTaskState(bundleState);
          }
 else           if (VmStateSet.RUN.apply(VmInstance.this) && VmStateSet.RUN.contains(runVmState)) {
            VmInstance.this.setState(runVmState,Reason.APPEND,"String_Node_Str");
            this.updateState(runVm);
          }
 else           if (VmState.SHUTTING_DOWN.apply(VmInstance.this) && VmState.SHUTTING_DOWN.equals(runVmState)) {
            VmInstance.this.setState(VmState.TERMINATED,Reason.APPEND,"String_Node_Str");
          }
 else           if (VmState.STOPPING.apply(VmInstance.this) && VmInstances.Timeout.SHUTTING_DOWN.apply(VmInstance.this)) {
            VmInstance.this.setState(VmState.STOPPED,Reason.EXPIRED);
          }
 else           if (VmState.SHUTTING_DOWN.apply(VmInstance.this) && VmInstances.Timeout.SHUTTING_DOWN.apply(VmInstance.this)) {
            VmInstance.this.setState(VmState.TERMINATED,Reason.EXPIRED);
          }
 else           if (VmStateSet.NOT_RUNNING.apply(VmInstance.this) && VmStateSet.RUN.contains(runVmState)) {
            VmInstance.this.setState(VmState.RUNNING,Reason.APPEND,"String_Node_Str");
          }
 else {
            this.updateState(runVm);
          }
          VmInstance.this.fireUsageEvent();
          db.commit();
        }
 catch (        final Exception ex) {
          Logs.exhaust().error(ex,ex);
          db.rollback();
        }
      }
      return true;
    }
    private void updateState(    final VmInfo runVm){
      VmInstance.this.getRuntimeState().setServiceTag(runVm.getServiceTag());
      VmInstance.this.getRuntimeState().updateBundleTaskState(runVm.getBundleTaskStateName());
      VmInstance.this.updateCreateImageTaskState(runVm.getBundleTaskStateName());
      VmInstance.this.updateVolumeAttachments(runVm.getVolumes());
      VmInstance.this.updateAddresses(runVm.getNetParams().getIpAddress(),runVm.getNetParams().getIgnoredPublicIp());
      VmInstance.this.updateBlockBytes(runVm.getBlockBytes());
      VmInstance.this.updateNetworkBytes(runVm.getNetworkBytes());
    }
  }
;
}

Fixed version (ground truth):
/** 
 * @return
 */
public Predicate<VmInfo> doUpdate(){
  return new Predicate<VmInfo>(){
    @Override public boolean apply(    final VmInfo runVm){
      if (!Entities.isPersistent(VmInstance.this)) {
        throw new TransientEntityException(this.toString());
      }
 else {
        final EntityTransaction db=Entities.get(VmInstance.class);
        try {
          final VmState runVmState=VmState.Mapper.get(runVm.getStateName());
          if (VmInstance.this.getRuntimeState().isBundling()) {
            final BundleState bundleState=BundleState.mapper.apply(runVm.getBundleTaskStateName());
            VmInstance.this.getRuntimeState().updateBundleTaskState(bundleState);
          }
 else           if (VmStateSet.RUN.apply(VmInstance.this) && VmStateSet.RUN.contains(runVmState)) {
            VmInstance.this.setState(runVmState,Reason.APPEND,"String_Node_Str");
            this.updateState(runVm);
          }
 else           if (VmState.SHUTTING_DOWN.apply(VmInstance.this) && VmState.SHUTTING_DOWN.equals(runVmState)) {
            VmInstance.this.setState(VmState.TERMINATED,Reason.APPEND,"String_Node_Str");
          }
 else           if (VmState.STOPPING.apply(VmInstance.this) && VmInstances.Timeout.SHUTTING_DOWN.apply(VmInstance.this)) {
            VmInstance.this.setState(VmState.STOPPED,Reason.EXPIRED);
          }
 else           if (VmState.SHUTTING_DOWN.apply(VmInstance.this) && VmInstances.Timeout.SHUTTING_DOWN.apply(VmInstance.this)) {
            VmInstance.this.setState(VmState.TERMINATED,Reason.EXPIRED);
          }
 else           if (VmStateSet.NOT_RUNNING.apply(VmInstance.this) && VmStateSet.RUN.contains(runVmState)) {
            VmInstance.this.setState(VmState.RUNNING,Reason.APPEND,"String_Node_Str");
          }
 else {
            this.updateState(runVm);
          }
          VmInstance.this.fireUsageEvent();
          db.commit();
        }
 catch (        final Exception ex) {
          Logs.extreme().error(ex,ex);
          db.rollback();
        }
      }
      return true;
    }
    private void updateState(    final VmInfo runVm){
      VmInstance.this.getRuntimeState().setServiceTag(runVm.getServiceTag());
      VmInstance.this.getRuntimeState().updateBundleTaskState(runVm.getBundleTaskStateName());
      VmInstance.this.updateCreateImageTaskState(runVm.getBundleTaskStateName());
      VmInstance.this.updateVolumeAttachments(runVm.getVolumes());
      VmInstance.this.updateAddresses(runVm.getNetParams().getIpAddress(),runVm.getNetParams().getIgnoredPublicIp());
      VmInstance.this.updateBlockBytes(runVm.getBlockBytes());
      VmInstance.this.updateNetworkBytes(runVm.getNetworkBytes());
    }
  }
;
}