Program: 107035
Project: 107035
Buggy source:
@Override public VolumeResponse createVolumeResponse(Volume volume){
  VolumeResponse volResponse=new VolumeResponse();
  volResponse.setId(volume.getId());
  if (volume.getName() != null) {
    volResponse.setName(volume.getName());
  }
 else {
    volResponse.setName("String_Node_Str");
  }
  volResponse.setZoneId(volume.getDataCenterId());
  volResponse.setZoneName(ApiDBUtils.findZoneById(volume.getDataCenterId()).getName());
  volResponse.setVolumeType(volume.getVolumeType().toString());
  volResponse.setDeviceId(volume.getDeviceId());
  Long instanceId=volume.getInstanceId();
  if (instanceId != null && volume.getState() != Volume.State.Destroy) {
    VMInstanceVO vm=ApiDBUtils.findVMInstanceById(instanceId);
    volResponse.setVirtualMachineId(vm.getId());
    volResponse.setVirtualMachineName(vm.getHostName());
    UserVm userVm=ApiDBUtils.findUserVmById(vm.getId());
    volResponse.setVirtualMachineDisplayName(userVm.getDisplayName());
    volResponse.setVirtualMachineState(vm.getState().toString());
  }
  volResponse.setSize(volume.getSize());
  volResponse.setCreated(volume.getCreated());
  volResponse.setState(volume.getState().toString());
  Account accountTemp=ApiDBUtils.findAccountById(volume.getAccountId());
  if (accountTemp != null) {
    volResponse.setAccountName(accountTemp.getAccountName());
    volResponse.setDomainId(accountTemp.getDomainId());
    volResponse.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName());
  }
  String storageType;
  try {
    if (volume.getPoolId() == null) {
      if (volume.getState() == Volume.State.Allocated) {
        storageType="String_Node_Str";
      }
 else {
        storageType="String_Node_Str";
      }
    }
 else {
      storageType=ApiDBUtils.volumeIsOnSharedStorage(volume.getId()) ? "String_Node_Str" : "String_Node_Str";
    }
  }
 catch (  InvalidParameterValueException e) {
    s_logger.error(e.getMessage(),e);
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str" + volume.getName() + "String_Node_Str");
  }
  volResponse.setStorageType(storageType);
  if (volume.getVolumeType().equals(Volume.Type.ROOT)) {
    volResponse.setServiceOfferingId(volume.getDiskOfferingId());
  }
 else {
    volResponse.setDiskOfferingId(volume.getDiskOfferingId());
  }
  DiskOfferingVO diskOffering=ApiDBUtils.findDiskOfferingById(volume.getDiskOfferingId());
  if (volume.getVolumeType().equals(Volume.Type.ROOT)) {
    volResponse.setServiceOfferingName(diskOffering.getName());
    volResponse.setServiceOfferingDisplayText(diskOffering.getDisplayText());
  }
 else {
    volResponse.setDiskOfferingName(diskOffering.getName());
    volResponse.setDiskOfferingDisplayText(diskOffering.getDisplayText());
  }
  Long poolId=volume.getPoolId();
  String poolName=(poolId == null) ? "String_Node_Str" : ApiDBUtils.findStoragePoolById(poolId).getName();
  volResponse.setStoragePoolName(poolName);
  volResponse.setHypervisor(ApiDBUtils.getVolumeHyperType(volume.getId()).toString());
  volResponse.setAttached(volume.getAttached());
  volResponse.setDestroyed(volume.getState() == Volume.State.Destroy);
  VMTemplateVO template=ApiDBUtils.findTemplateById(volume.getTemplateId());
  boolean isExtractable=template != null && template.isExtractable() && !(template.getTemplateType() == TemplateType.SYSTEM);
  volResponse.setExtractable(isExtractable);
  volResponse.setObjectName("String_Node_Str");
  return volResponse;
}

Fixed version (ground truth):
@Override public VolumeResponse createVolumeResponse(Volume volume){
  VolumeResponse volResponse=new VolumeResponse();
  volResponse.setId(volume.getId());
  if (volume.getName() != null) {
    volResponse.setName(volume.getName());
  }
 else {
    volResponse.setName("String_Node_Str");
  }
  volResponse.setZoneId(volume.getDataCenterId());
  volResponse.setZoneName(ApiDBUtils.findZoneById(volume.getDataCenterId()).getName());
  volResponse.setVolumeType(volume.getVolumeType().toString());
  volResponse.setDeviceId(volume.getDeviceId());
  Long instanceId=volume.getInstanceId();
  if (instanceId != null && volume.getState() != Volume.State.Destroy) {
    VMInstanceVO vm=ApiDBUtils.findVMInstanceById(instanceId);
    volResponse.setVirtualMachineId(vm.getId());
    volResponse.setVirtualMachineName(vm.getHostName());
    UserVm userVm=ApiDBUtils.findUserVmById(vm.getId());
    if (userVm != null) {
      volResponse.setVirtualMachineDisplayName(userVm.getDisplayName());
      volResponse.setVirtualMachineState(vm.getState().toString());
    }
  }
  volResponse.setSize(volume.getSize());
  volResponse.setCreated(volume.getCreated());
  volResponse.setState(volume.getState().toString());
  Account accountTemp=ApiDBUtils.findAccountById(volume.getAccountId());
  if (accountTemp != null) {
    volResponse.setAccountName(accountTemp.getAccountName());
    volResponse.setDomainId(accountTemp.getDomainId());
    volResponse.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName());
  }
  String storageType;
  try {
    if (volume.getPoolId() == null) {
      if (volume.getState() == Volume.State.Allocated) {
        storageType="String_Node_Str";
      }
 else {
        storageType="String_Node_Str";
      }
    }
 else {
      storageType=ApiDBUtils.volumeIsOnSharedStorage(volume.getId()) ? "String_Node_Str" : "String_Node_Str";
    }
  }
 catch (  InvalidParameterValueException e) {
    s_logger.error(e.getMessage(),e);
    throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"String_Node_Str" + volume.getName() + "String_Node_Str");
  }
  volResponse.setStorageType(storageType);
  if (volume.getVolumeType().equals(Volume.Type.ROOT)) {
    volResponse.setServiceOfferingId(volume.getDiskOfferingId());
  }
 else {
    volResponse.setDiskOfferingId(volume.getDiskOfferingId());
  }
  DiskOfferingVO diskOffering=ApiDBUtils.findDiskOfferingById(volume.getDiskOfferingId());
  if (volume.getVolumeType().equals(Volume.Type.ROOT)) {
    volResponse.setServiceOfferingName(diskOffering.getName());
    volResponse.setServiceOfferingDisplayText(diskOffering.getDisplayText());
  }
 else {
    volResponse.setDiskOfferingName(diskOffering.getName());
    volResponse.setDiskOfferingDisplayText(diskOffering.getDisplayText());
  }
  Long poolId=volume.getPoolId();
  String poolName=(poolId == null) ? "String_Node_Str" : ApiDBUtils.findStoragePoolById(poolId).getName();
  volResponse.setStoragePoolName(poolName);
  volResponse.setHypervisor(ApiDBUtils.getVolumeHyperType(volume.getId()).toString());
  volResponse.setAttached(volume.getAttached());
  volResponse.setDestroyed(volume.getState() == Volume.State.Destroy);
  VMTemplateVO template=ApiDBUtils.findTemplateById(volume.getTemplateId());
  boolean isExtractable=template != null && template.isExtractable() && !(template.getTemplateType() == TemplateType.SYSTEM);
  volResponse.setExtractable(isExtractable);
  volResponse.setObjectName("String_Node_Str");
  return volResponse;
}