Program: 106452
Project: 106452
Buggy source:
@Override public Host updateHost(UpdateHostCmd cmd) throws NoTransitionException {
  Long hostId=cmd.getId();
  Long guestOSCategoryId=cmd.getOsCategoryId();
  HostVO host=_hostDao.findById(hostId);
  if (host == null) {
    throw new InvalidParameterValueException("String_Node_Str" + hostId + "String_Node_Str");
  }
  if (cmd.getAllocationState() != null) {
    ResourceState.Event resourceEvent=ResourceState.Event.toEvent(cmd.getAllocationState());
    if (resourceEvent != ResourceState.Event.Enable && resourceEvent != ResourceState.Event.Disable) {
      throw new CloudRuntimeException("String_Node_Str" + cmd.getAllocationState() + "String_Node_Str");
    }
    resourceStateTransitTo(host,resourceEvent,_nodeId);
  }
  if (guestOSCategoryId != null) {
    if (guestOSCategoryId > 0) {
      if (_guestOSCategoryDao.findById(guestOSCategoryId) == null) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
    }
    GuestOSCategoryVO guestOSCategory=_guestOSCategoryDao.findById(guestOSCategoryId);
    Map<String,String> hostDetails=_hostDetailsDao.findDetails(hostId);
    if (guestOSCategory != null) {
      hostDetails.put("String_Node_Str",String.valueOf(guestOSCategory.getId()));
    }
 else {
      hostDetails.remove("String_Node_Str");
    }
    _hostDetailsDao.persist(hostId,hostDetails);
  }
  List<String> hostTags=cmd.getHostTags();
  if (hostTags != null) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + hostTags);
    }
    _hostTagsDao.persist(hostId,hostTags);
  }
  String url=cmd.getUrl();
  if (url != null) {
    _storageMgr.updateSecondaryStorage(cmd.getId(),cmd.getUrl());
  }
  HostVO updatedHost=_hostDao.findById(hostId);
  return updatedHost;
}

Fixed version (ground truth):
@Override public Host updateHost(UpdateHostCmd cmd) throws NoTransitionException {
  Long hostId=cmd.getId();
  Long guestOSCategoryId=cmd.getOsCategoryId();
  HostVO host=_hostDao.findById(hostId);
  if (host == null) {
    throw new InvalidParameterValueException("String_Node_Str" + hostId + "String_Node_Str");
  }
  if (cmd.getAllocationState() != null) {
    ResourceState.Event resourceEvent=ResourceState.Event.toEvent(cmd.getAllocationState());
    if (resourceEvent != ResourceState.Event.Enable && resourceEvent != ResourceState.Event.Disable) {
      throw new CloudRuntimeException("String_Node_Str" + cmd.getAllocationState() + "String_Node_Str");
    }
    resourceStateTransitTo(host,resourceEvent,_nodeId);
  }
  if (guestOSCategoryId != null) {
    if (guestOSCategoryId > 0) {
      if (_guestOSCategoryDao.findById(guestOSCategoryId) == null) {
        throw new InvalidParameterValueException("String_Node_Str");
      }
    }
    GuestOSCategoryVO guestOSCategory=_guestOSCategoryDao.findById(guestOSCategoryId);
    Map<String,String> hostDetails=_hostDetailsDao.findDetails(hostId);
    if (guestOSCategory != null && !GuestOSCategoryVO.CATEGORY_NONE.equalsIgnoreCase(guestOSCategory.getName())) {
      hostDetails.put("String_Node_Str",String.valueOf(guestOSCategory.getId()));
    }
 else {
      hostDetails.remove("String_Node_Str");
    }
    _hostDetailsDao.persist(hostId,hostDetails);
  }
  List<String> hostTags=cmd.getHostTags();
  if (hostTags != null) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + hostTags);
    }
    _hostTagsDao.persist(hostId,hostTags);
  }
  String url=cmd.getUrl();
  if (url != null) {
    _storageMgr.updateSecondaryStorage(cmd.getId(),cmd.getUrl());
  }
  HostVO updatedHost=_hostDao.findById(hostId);
  return updatedHost;
}