Program: 105426
Project: 105426
Buggy source:
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_VOLUME_UPLOAD,eventDescription="String_Node_Str",async=true) public GetUploadParamsResponse uploadVolume(GetUploadParamsForVolumeCmd cmd) throws ResourceAllocationException, MalformedURLException {
  Account caller=CallContext.current().getCallingAccount();
  long ownerId=cmd.getEntityOwnerId();
  Account owner=_entityMgr.findById(Account.class,ownerId);
  Long zoneId=cmd.getZoneId();
  String volumeName=cmd.getName();
  String format=cmd.getFormat();
  Long diskOfferingId=cmd.getDiskOfferingId();
  String imageStoreUuid=cmd.getImageStoreUuid();
  DataStore store=_tmpltMgr.getImageStore(imageStoreUuid,zoneId);
  validateVolume(caller,ownerId,zoneId,volumeName,null,format,diskOfferingId);
  VolumeVO volume=persistVolume(owner,zoneId,volumeName,null,cmd.getFormat(),diskOfferingId);
  VolumeInfo vol=volFactory.getVolume(volume.getId());
  RegisterVolumePayload payload=new RegisterVolumePayload(null,cmd.getChecksum(),cmd.getFormat());
  vol.addPayload(payload);
  EndPoint ep=volService.registerVolumeForPostUpload(vol,store);
  TemplateOrVolumePostUploadCommand command=new TemplateOrVolumePostUploadCommand(vol,ep);
  GetUploadParamsResponse response=new GetUploadParamsResponse();
  String url="String_Node_Str" + command.getEndPoint().getPublicAddr() + "String_Node_Str"+ command.getDataObject().getUuid();
  response.setPostURL(new URL(url));
  response.setId(UUID.fromString(command.getDataObject().getUuid()));
  DateTime currentDateTime=new DateTime(DateTimeZone.UTC);
  currentDateTime.plusHours(1);
  String expires=currentDateTime.toString();
  response.setTimeout(expires);
  String key=_configDao.getValue(Config.SSVMPSK.key());
  Gson gson=new GsonBuilder().setExclusionStrategies(new ExclusionStrategy(){
    @Override public boolean shouldSkipField(    FieldAttributes f){
      return f.getDeclaredType().getClass().isInstance(Logger.class);
    }
    @Override public boolean shouldSkipClass(    Class<?> clazz){
      return false;
    }
  }
).create();
  String jsonPayload=gson.toJson(command);
  response.setMetadata(EncryptionUtil.encodeData(jsonPayload,key));
  response.setSignature(EncryptionUtil.generateSignature(jsonPayload + url + expires,key));
  return response;
}

Fixed version (ground truth):
@Override @DB @ActionEvent(eventType=EventTypes.EVENT_VOLUME_UPLOAD,eventDescription="String_Node_Str",async=true) public GetUploadParamsResponse uploadVolume(GetUploadParamsForVolumeCmd cmd) throws ResourceAllocationException, MalformedURLException {
  Account caller=CallContext.current().getCallingAccount();
  long ownerId=cmd.getEntityOwnerId();
  Account owner=_entityMgr.findById(Account.class,ownerId);
  Long zoneId=cmd.getZoneId();
  String volumeName=cmd.getName();
  String format=cmd.getFormat();
  Long diskOfferingId=cmd.getDiskOfferingId();
  String imageStoreUuid=cmd.getImageStoreUuid();
  DataStore store=_tmpltMgr.getImageStore(imageStoreUuid,zoneId);
  validateVolume(caller,ownerId,zoneId,volumeName,null,format,diskOfferingId);
  VolumeVO volume=persistVolume(owner,zoneId,volumeName,null,cmd.getFormat(),diskOfferingId);
  VolumeInfo vol=volFactory.getVolume(volume.getId());
  RegisterVolumePayload payload=new RegisterVolumePayload(null,cmd.getChecksum(),cmd.getFormat());
  vol.addPayload(payload);
  EndPoint ep=volService.registerVolumeForPostUpload(vol,store);
  TemplateOrVolumePostUploadCommand command=new TemplateOrVolumePostUploadCommand(vol,ep);
  GetUploadParamsResponse response=new GetUploadParamsResponse();
  String url="String_Node_Str" + command.getEndPoint().getPublicAddr() + "String_Node_Str"+ command.getDataObject().getUuid();
  response.setPostURL(new URL(url));
  response.setId(UUID.fromString(command.getDataObject().getUuid()));
  DateTime currentDateTime=new DateTime(DateTimeZone.UTC);
  currentDateTime.plusHours(1);
  String expires=currentDateTime.toString();
  response.setTimeout(expires);
  String key=_configDao.getValue(Config.SSVMPSK.key());
  Gson gson=new GsonBuilder().registerTypeAdapter(TemplateOrVolumePostUploadCommand.class,new TemplateOrVolumePostUploadCommandTypeAdapter()).create();
  String jsonPayload=gson.toJson(command);
  response.setMetadata(EncryptionUtil.encodeData(jsonPayload,key));
  response.setSignature(EncryptionUtil.generateSignature(jsonPayload + url + expires,key));
  return response;
}