Program: 107441
Project: 107441
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public ListResponse<UserVmResponse> getResponse(){
  List<UserVmVO> userVms=(List<UserVmVO>)getResponseObject();
  ListResponse<UserVmResponse> response=new ListResponse<UserVmResponse>();
  List<UserVmResponse> vmResponses=new ArrayList<UserVmResponse>();
  for (  UserVmVO userVm : userVms) {
    UserVmResponse userVmResponse=new UserVmResponse();
    userVmResponse.setId(userVm.getId());
    AsyncJobVO asyncJob=ApiDBUtils.findInstancePendingAsyncJob("String_Node_Str",userVm.getId());
    if (asyncJob != null) {
      userVmResponse.setJobId(asyncJob.getId());
      userVmResponse.setJobStatus(asyncJob.getStatus());
    }
    userVmResponse.setName(userVm.getName());
    userVmResponse.setCreated(userVm.getCreated());
    userVmResponse.setIpAddress(userVm.getPrivateIpAddress());
    if (userVm.getState() != null) {
      userVmResponse.setState(userVm.getState().toString());
    }
    Account acct=ApiDBUtils.findAccountById(Long.valueOf(userVm.getAccountId()));
    if (acct != null) {
      userVmResponse.setAccountName(acct.getAccountName());
      userVmResponse.setDomainId(acct.getDomainId());
      userVmResponse.setDomainName(ApiDBUtils.findDomainById(acct.getDomainId()).getName());
    }
    userVmResponse.setHaEnable(userVm.isHaEnabled());
    if (userVm.getDisplayName() != null) {
      userVmResponse.setDisplayName(userVm.getDisplayName());
    }
 else {
      userVmResponse.setDisplayName(userVm.getName());
    }
    InstanceGroupVO group=ApiDBUtils.findInstanceGroupForVM(userVm.getId());
    if (group != null) {
      userVmResponse.setGroup(group.getName());
      userVmResponse.setGroupId(group.getId());
    }
    userVmResponse.setZoneId(userVm.getDataCenterId());
    userVmResponse.setZoneName(ApiDBUtils.findZoneById(userVm.getDataCenterId()).getName());
    Account account=(Account)UserContext.current().getAccount();
    if (((account == null) || isAdmin(account.getType())) && (userVm.getHostId() != null)) {
      userVmResponse.setHostId(userVm.getHostId());
      userVmResponse.setHostName(ApiDBUtils.findHostById(userVm.getHostId()).getName());
    }
    VMTemplateVO template=ApiDBUtils.findTemplateById(userVm.getTemplateId());
    if (template != null) {
      userVmResponse.setTemplateId(userVm.getTemplateId());
      userVmResponse.setTemplateName(template.getName());
      userVmResponse.setTemplateDisplayText(template.getDisplayText());
      userVmResponse.setPasswordEnabled(template.getEnablePassword());
    }
 else {
      userVmResponse.setTemplateId(-1L);
      userVmResponse.setTemplateName("String_Node_Str");
      userVmResponse.setTemplateDisplayText("String_Node_Str");
      userVmResponse.setPasswordEnabled(false);
    }
    if (userVm.getIsoId() != null) {
      VMTemplateVO iso=ApiDBUtils.findTemplateById(userVm.getIsoId().longValue());
      if (iso != null) {
        userVmResponse.setIsoId(userVm.getIsoId());
        userVmResponse.setIsoName(iso.getName());
      }
    }
    ServiceOffering offering=ApiDBUtils.findServiceOfferingById(userVm.getServiceOfferingId());
    userVmResponse.setServiceOfferingId(userVm.getServiceOfferingId());
    userVmResponse.setServiceOfferingName(offering.getName());
    userVmResponse.setCpuNumber(offering.getCpu());
    userVmResponse.setCpuSpeed(offering.getSpeed());
    userVmResponse.setMemory(offering.getRamSize());
    DecimalFormat decimalFormat=new DecimalFormat("String_Node_Str");
    String cpuUsed=null;
    VmStats vmStats=ApiDBUtils.getVmStatistics(userVm.getId());
    if (vmStats != null) {
      float cpuUtil=(float)vmStats.getCPUUtilization();
      cpuUsed=decimalFormat.format(cpuUtil) + "String_Node_Str";
      userVmResponse.setCpuUsed(cpuUsed);
      long networkKbRead=(long)vmStats.getNetworkReadKBs();
      userVmResponse.setNetworkKbsRead(networkKbRead);
      long networkKbWrite=(long)vmStats.getNetworkWriteKBs();
      userVmResponse.setNetworkKbsWrite(networkKbWrite);
    }
    userVmResponse.setOsTypeId(userVm.getGuestOSId());
    userVmResponse.setNetworkGroupList(ApiDBUtils.getNetworkGroupsNamesForVm(userVm.getId()));
    userVmResponse.setResponseName("String_Node_Str");
    vmResponses.add(userVmResponse);
  }
  response.setResponses(vmResponses);
  response.setResponseName(getName());
  return response;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public ListResponse<UserVmResponse> getResponse(){
  List<UserVmVO> userVms=(List<UserVmVO>)getResponseObject();
  ListResponse<UserVmResponse> response=new ListResponse<UserVmResponse>();
  List<UserVmResponse> vmResponses=new ArrayList<UserVmResponse>();
  for (  UserVmVO userVm : userVms) {
    UserVmResponse userVmResponse=new UserVmResponse();
    userVmResponse.setId(userVm.getId());
    AsyncJobVO asyncJob=ApiDBUtils.findInstancePendingAsyncJob("String_Node_Str",userVm.getId());
    if (asyncJob != null) {
      userVmResponse.setJobId(asyncJob.getId());
      userVmResponse.setJobStatus(asyncJob.getStatus());
    }
    userVmResponse.setName(userVm.getName());
    userVmResponse.setCreated(userVm.getCreated());
    userVmResponse.setIpAddress(userVm.getPrivateIpAddress());
    if (userVm.getState() != null) {
      userVmResponse.setState(userVm.getState().toString());
    }
    Account acct=ApiDBUtils.findAccountById(Long.valueOf(userVm.getAccountId()));
    if (acct != null) {
      userVmResponse.setAccountName(acct.getAccountName());
      userVmResponse.setDomainId(acct.getDomainId());
      userVmResponse.setDomainName(ApiDBUtils.findDomainById(acct.getDomainId()).getName());
    }
    userVmResponse.setHaEnable(userVm.isHaEnabled());
    if (userVm.getDisplayName() != null) {
      userVmResponse.setDisplayName(userVm.getDisplayName());
    }
 else {
      userVmResponse.setDisplayName(userVm.getName());
    }
    InstanceGroupVO group=ApiDBUtils.findInstanceGroupForVM(userVm.getId());
    if (group != null) {
      userVmResponse.setGroup(group.getName());
      userVmResponse.setGroupId(group.getId());
    }
    userVmResponse.setZoneId(userVm.getDataCenterId());
    userVmResponse.setZoneName(ApiDBUtils.findZoneById(userVm.getDataCenterId()).getName());
    Account account=(Account)UserContext.current().getAccount();
    if (((account == null) || isAdmin(account.getType())) && (userVm.getHostId() != null)) {
      userVmResponse.setHostId(userVm.getHostId());
      userVmResponse.setHostName(ApiDBUtils.findHostById(userVm.getHostId()).getName());
    }
    VMTemplateVO template=ApiDBUtils.findTemplateById(userVm.getTemplateId());
    if (template != null) {
      userVmResponse.setTemplateId(userVm.getTemplateId());
      userVmResponse.setTemplateName(template.getName());
      userVmResponse.setTemplateDisplayText(template.getDisplayText());
      userVmResponse.setPasswordEnabled(template.getEnablePassword());
    }
 else {
      userVmResponse.setTemplateId(-1L);
      userVmResponse.setTemplateName("String_Node_Str");
      userVmResponse.setTemplateDisplayText("String_Node_Str");
      userVmResponse.setPasswordEnabled(false);
    }
    if (userVm.getIsoId() != null) {
      VMTemplateVO iso=ApiDBUtils.findTemplateById(userVm.getIsoId().longValue());
      if (iso != null) {
        userVmResponse.setIsoId(userVm.getIsoId());
        userVmResponse.setIsoName(iso.getName());
      }
    }
    ServiceOffering offering=ApiDBUtils.findServiceOfferingById(userVm.getServiceOfferingId());
    userVmResponse.setServiceOfferingId(userVm.getServiceOfferingId());
    userVmResponse.setServiceOfferingName(offering.getName());
    userVmResponse.setCpuNumber(offering.getCpu());
    userVmResponse.setCpuSpeed(offering.getSpeed());
    userVmResponse.setMemory(offering.getRamSize());
    VolumeVO rootVolume=ApiDBUtils.findRootVolume(userVm.getId());
    if (rootVolume != null) {
      userVmResponse.setRootDeviceId(rootVolume.getDeviceId());
      StoragePoolVO storagePool=ApiDBUtils.findStoragePoolById(rootVolume.getPoolId());
      userVmResponse.setRootDeviceType(storagePool.getPoolType().toString());
    }
    DecimalFormat decimalFormat=new DecimalFormat("String_Node_Str");
    String cpuUsed=null;
    VmStats vmStats=ApiDBUtils.getVmStatistics(userVm.getId());
    if (vmStats != null) {
      float cpuUtil=(float)vmStats.getCPUUtilization();
      cpuUsed=decimalFormat.format(cpuUtil) + "String_Node_Str";
      userVmResponse.setCpuUsed(cpuUsed);
      long networkKbRead=(long)vmStats.getNetworkReadKBs();
      userVmResponse.setNetworkKbsRead(networkKbRead);
      long networkKbWrite=(long)vmStats.getNetworkWriteKBs();
      userVmResponse.setNetworkKbsWrite(networkKbWrite);
    }
    userVmResponse.setGuestOsId(userVm.getGuestOSId());
    userVmResponse.setNetworkGroupList(ApiDBUtils.getNetworkGroupsNamesForVm(userVm.getId()));
    userVmResponse.setResponseName("String_Node_Str");
    vmResponses.add(userVmResponse);
  }
  response.setResponses(vmResponses);
  response.setResponseName(getName());
  return response;
}