Program: 107440
Project: 107440
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public UserVmResponse getResponse(){
  UserVm userVm=(UserVm)getResponseObject();
  UserVmResponse response=new UserVmResponse();
  response.setId(userVm.getId());
  response.setName(userVm.getName());
  response.setCreated(userVm.getCreated());
  response.setZoneId(userVm.getDataCenterId());
  response.setZoneName(ApiDBUtils.findZoneById(userVm.getDataCenterId()).getName());
  response.setIpAddress(userVm.getPrivateIpAddress());
  response.setServiceOfferingId(userVm.getServiceOfferingId());
  response.setHaEnable(userVm.isHaEnabled());
  InstanceGroupVO group=ApiDBUtils.findInstanceGroupForVM(userVm.getId());
  if (group != null) {
    response.setGroup(group.getName());
    response.setGroupId(group.getId());
  }
  if (userVm.getDisplayName() == null || userVm.getDisplayName().length() == 0) {
    response.setDisplayName(userVm.getName());
  }
 else {
    response.setDisplayName(userVm.getDisplayName());
  }
  if (userVm.getState() != null) {
    response.setState(userVm.getState().toString());
  }
  VMTemplateVO template=ApiDBUtils.findTemplateById(userVm.getTemplateId());
  Account acct=ApiDBUtils.findAccountById(Long.valueOf(userVm.getAccountId()));
  if (acct != null) {
    response.setAccountName(acct.getAccountName());
    response.setDomainId(acct.getDomainId());
    response.setDomainName(ApiDBUtils.findDomainById(acct.getDomainId()).getName());
  }
  Long userId=UserContext.current().getUserId();
  if (userId == null) {
    userId=User.UID_SYSTEM;
  }
  User userExecutingCmd=ApiDBUtils.findUserById(userId);
  Account acctForUserExecutingCmd=ApiDBUtils.findAccountById(Long.valueOf(userExecutingCmd.getAccountId()));
  if ((BaseCmd.isAdmin(acctForUserExecutingCmd.getType()) && (userVm.getHostId() != null)) || (BaseCmd.isAdmin(acct.getType()) && (userVm.getHostId() != null))) {
    response.setHostName(ApiDBUtils.findHostById(userVm.getHostId()).getName());
    response.setHostId(userVm.getHostId());
  }
  String templateName="String_Node_Str";
  boolean templatePasswordEnabled=false;
  String templateDisplayText=null;
  if (template != null) {
    templateName=template.getName();
    templatePasswordEnabled=template.getEnablePassword();
    templateDisplayText=template.getDisplayText();
    if (templateDisplayText == null) {
      templateDisplayText=templateName;
    }
  }
  if (templatePasswordEnabled) {
    response.setPassword(getPassword());
  }
  Long isoId=userVm.getIsoId();
  if (isoId != null) {
    VMTemplateVO iso=ApiDBUtils.findTemplateById(isoId.longValue());
    if (iso != null) {
      response.setIsoId(isoId.longValue());
      response.setIsoName(iso.getName());
      response.setTemplateId(isoId.longValue());
      response.setTemplateName(iso.getName());
      templateDisplayText=iso.getDisplayText();
      if (templateDisplayText == null)       templateDisplayText=iso.getName();
      response.setIsoDisplayText(templateDisplayText);
      response.setTemplateDisplayText(templateDisplayText);
    }
  }
 else {
    response.setTemplateId(userVm.getTemplateId());
    response.setTemplateName(templateName);
    response.setTemplateDisplayText(templateDisplayText);
    response.setPasswordEnabled(templatePasswordEnabled);
  }
  ServiceOffering offering=ApiDBUtils.findServiceOfferingById(userVm.getServiceOfferingId());
  response.setServiceOfferingId(userVm.getServiceOfferingId());
  response.setServiceOfferingName(offering.getName());
  response.setCpuNumber(offering.getCpu());
  response.setCpuSpeed(offering.getSpeed());
  response.setMemory(offering.getRamSize());
  response.setNetworkGroupList(ApiDBUtils.getNetworkGroupsNamesForVm(userVm.getId()));
  response.setResponseName(getName());
  return response;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public UserVmResponse getResponse(){
  UserVm userVm=(UserVm)getResponseObject();
  UserVmResponse response=new UserVmResponse();
  response.setId(userVm.getId());
  response.setName(userVm.getName());
  response.setCreated(userVm.getCreated());
  response.setZoneId(userVm.getDataCenterId());
  response.setZoneName(ApiDBUtils.findZoneById(userVm.getDataCenterId()).getName());
  response.setIpAddress(userVm.getPrivateIpAddress());
  response.setServiceOfferingId(userVm.getServiceOfferingId());
  response.setHaEnable(userVm.isHaEnabled());
  InstanceGroupVO group=ApiDBUtils.findInstanceGroupForVM(userVm.getId());
  if (group != null) {
    response.setGroup(group.getName());
    response.setGroupId(group.getId());
  }
  if (userVm.getDisplayName() == null || userVm.getDisplayName().length() == 0) {
    response.setDisplayName(userVm.getName());
  }
 else {
    response.setDisplayName(userVm.getDisplayName());
  }
  if (userVm.getState() != null) {
    response.setState(userVm.getState().toString());
  }
  VMTemplateVO template=ApiDBUtils.findTemplateById(userVm.getTemplateId());
  Account acct=ApiDBUtils.findAccountById(Long.valueOf(userVm.getAccountId()));
  if (acct != null) {
    response.setAccountName(acct.getAccountName());
    response.setDomainId(acct.getDomainId());
    response.setDomainName(ApiDBUtils.findDomainById(acct.getDomainId()).getName());
  }
  Long userId=UserContext.current().getUserId();
  if (userId == null) {
    userId=User.UID_SYSTEM;
  }
  User userExecutingCmd=ApiDBUtils.findUserById(userId);
  Account acctForUserExecutingCmd=ApiDBUtils.findAccountById(Long.valueOf(userExecutingCmd.getAccountId()));
  if ((BaseCmd.isAdmin(acctForUserExecutingCmd.getType()) && (userVm.getHostId() != null)) || (BaseCmd.isAdmin(acct.getType()) && (userVm.getHostId() != null))) {
    response.setHostName(ApiDBUtils.findHostById(userVm.getHostId()).getName());
    response.setHostId(userVm.getHostId());
  }
  String templateName="String_Node_Str";
  boolean templatePasswordEnabled=false;
  String templateDisplayText=null;
  if (template != null) {
    templateName=template.getName();
    templatePasswordEnabled=template.getEnablePassword();
    templateDisplayText=template.getDisplayText();
    if (templateDisplayText == null) {
      templateDisplayText=templateName;
    }
  }
  if (templatePasswordEnabled) {
    response.setPassword(getPassword());
  }
  Long isoId=userVm.getIsoId();
  if (isoId != null) {
    VMTemplateVO iso=ApiDBUtils.findTemplateById(isoId.longValue());
    if (iso != null) {
      response.setIsoId(isoId.longValue());
      response.setIsoName(iso.getName());
      response.setTemplateId(isoId.longValue());
      response.setTemplateName(iso.getName());
      templateDisplayText=iso.getDisplayText();
      if (templateDisplayText == null)       templateDisplayText=iso.getName();
      response.setIsoDisplayText(templateDisplayText);
      response.setTemplateDisplayText(templateDisplayText);
    }
  }
 else {
    response.setTemplateId(userVm.getTemplateId());
    response.setTemplateName(templateName);
    response.setTemplateDisplayText(templateDisplayText);
    response.setPasswordEnabled(templatePasswordEnabled);
  }
  ServiceOffering offering=ApiDBUtils.findServiceOfferingById(userVm.getServiceOfferingId());
  response.setServiceOfferingId(userVm.getServiceOfferingId());
  response.setServiceOfferingName(offering.getName());
  response.setCpuNumber(offering.getCpu());
  response.setCpuSpeed(offering.getSpeed());
  response.setMemory(offering.getRamSize());
  VolumeVO rootVolume=ApiDBUtils.findRootVolume(userVm.getId());
  if (rootVolume != null) {
    response.setRootDeviceId(rootVolume.getDeviceId());
    StoragePoolVO storagePool=ApiDBUtils.findStoragePoolById(rootVolume.getPoolId());
    response.setRootDeviceType(storagePool.getPoolType().toString());
  }
  response.setGuestOsId(userVm.getGuestOSId());
  response.setNetworkGroupList(ApiDBUtils.getNetworkGroupsNamesForVm(userVm.getId()));
  response.setResponseName(getName());
  return response;
}