Program: 107289
Project: 107289
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) {
    VMInstanceVO vm=ApiDBUtils.findVMInstanceById(instanceId);
    volResponse.setVirtualMachineId(vm.getId());
    volResponse.setVirtualMachineName(vm.getHostName());
    volResponse.setVirtualMachineDisplayName(vm.getHostName());
    volResponse.setVirtualMachineState(vm.getState().toString());
  }
  volResponse.setSize(volume.getSize());
  volResponse.setCreated(volume.getCreated());
  volResponse.setState(volume.getStatus().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.VolumeType.ROOT)) {
    volResponse.setServiceOfferingId(volume.getDiskOfferingId());
  }
 else {
    volResponse.setDiskOfferingId(volume.getDiskOfferingId());
  }
  DiskOfferingVO diskOffering=ApiDBUtils.findDiskOfferingById(volume.getDiskOfferingId());
  if (volume.getVolumeType().equals(Volume.VolumeType.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.setSourceId(volume.getSourceId());
  if (volume.getSourceType() != null) {
    volResponse.setSourceType(volume.getSourceType().toString());
  }
  volResponse.setHypervisor(ApiDBUtils.getVolumeHyperType(volume.getId()).toString());
  volResponse.setAttached(volume.getAttached());
  volResponse.setDestroyed(volume.getDestroyed());
  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) {
    VMInstanceVO vm=ApiDBUtils.findVMInstanceById(instanceId);
    volResponse.setVirtualMachineId(vm.getId());
    volResponse.setVirtualMachineName(vm.getName());
    volResponse.setVirtualMachineDisplayName(vm.getName());
    volResponse.setVirtualMachineState(vm.getState().toString());
  }
  volResponse.setSize(volume.getSize());
  volResponse.setCreated(volume.getCreated());
  volResponse.setState(volume.getStatus().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.VolumeType.ROOT)) {
    volResponse.setServiceOfferingId(volume.getDiskOfferingId());
  }
 else {
    volResponse.setDiskOfferingId(volume.getDiskOfferingId());
  }
  DiskOfferingVO diskOffering=ApiDBUtils.findDiskOfferingById(volume.getDiskOfferingId());
  if (volume.getVolumeType().equals(Volume.VolumeType.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.setSourceId(volume.getSourceId());
  if (volume.getSourceType() != null) {
    volResponse.setSourceType(volume.getSourceType().toString());
  }
  volResponse.setHypervisor(ApiDBUtils.getVolumeHyperType(volume.getId()).toString());
  volResponse.setAttached(volume.getAttached());
  volResponse.setDestroyed(volume.getDestroyed());
  volResponse.setObjectName("String_Node_Str");
  return volResponse;
}