api/src/main/java/com/google/appengine/api/blobstore/ee10/BlobstoreServiceImpl.java [72:119]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public String createUploadUrl(String successPath, UploadOptions uploadOptions) {
    if (successPath == null) {
      throw new NullPointerException("Success path must not be null.");
    }

    CreateUploadURLRequest.Builder request =
        CreateUploadURLRequest.newBuilder().setSuccessPath(successPath);

    if (uploadOptions.hasMaxUploadSizeBytesPerBlob()) {
      request.setMaxUploadSizePerBlobBytes(uploadOptions.getMaxUploadSizeBytesPerBlob());
    }

    if (uploadOptions.hasMaxUploadSizeBytes()) {
      request.setMaxUploadSizeBytes(uploadOptions.getMaxUploadSizeBytes());
    }

    if (uploadOptions.hasGoogleStorageBucketName()) {
      request.setGsBucketName(uploadOptions.getGoogleStorageBucketName());
    }

    byte[] responseBytes;
    try {
      responseBytes =
          ApiProxy.makeSyncCall(PACKAGE, "CreateUploadURL", request.build().toByteArray());
    } catch (ApiProxy.ApplicationException ex) {
      switch (BlobstoreServiceError.ErrorCode.forNumber(ex.getApplicationError())) {
        case URL_TOO_LONG:
          throw new IllegalArgumentException("The resulting URL was too long.");
        case INTERNAL_ERROR:
          throw new BlobstoreFailureException("An internal blobstore error occurred.");
        default:
          throw new BlobstoreFailureException("An unexpected error occurred.", ex);
      }
    }

    try {
      CreateUploadURLResponse response =
          CreateUploadURLResponse.parseFrom(
              responseBytes, ExtensionRegistry.getEmptyRegistry());
      if (!response.isInitialized()) {
        throw new BlobstoreFailureException("Could not parse CreateUploadURLResponse");
      }
      return response.getUrl();

    } catch (InvalidProtocolBufferException e) {
      throw new IllegalArgumentException(e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



api/src/main/java/com/google/appengine/api/blobstore/BlobstoreServiceImpl.java [65:112]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public String createUploadUrl(String successPath, UploadOptions uploadOptions) {
    if (successPath == null) {
      throw new NullPointerException("Success path must not be null.");
    }

    CreateUploadURLRequest.Builder request =
        CreateUploadURLRequest.newBuilder().setSuccessPath(successPath);

    if (uploadOptions.hasMaxUploadSizeBytesPerBlob()) {
      request.setMaxUploadSizePerBlobBytes(uploadOptions.getMaxUploadSizeBytesPerBlob());
    }

    if (uploadOptions.hasMaxUploadSizeBytes()) {
      request.setMaxUploadSizeBytes(uploadOptions.getMaxUploadSizeBytes());
    }

    if (uploadOptions.hasGoogleStorageBucketName()) {
      request.setGsBucketName(uploadOptions.getGoogleStorageBucketName());
    }

    byte[] responseBytes;
    try {
      responseBytes =
          ApiProxy.makeSyncCall(PACKAGE, "CreateUploadURL", request.build().toByteArray());
    } catch (ApiProxy.ApplicationException ex) {
      switch (BlobstoreServiceError.ErrorCode.forNumber(ex.getApplicationError())) {
        case URL_TOO_LONG:
          throw new IllegalArgumentException("The resulting URL was too long.");
        case INTERNAL_ERROR:
          throw new BlobstoreFailureException("An internal blobstore error occurred.");
        default:
          throw new BlobstoreFailureException("An unexpected error occurred.", ex);
      }
    }

    try {
      CreateUploadURLResponse response =
          CreateUploadURLResponse.parseFrom(
              responseBytes, ExtensionRegistry.getEmptyRegistry());
      if (!response.isInitialized()) {
        throw new BlobstoreFailureException("Could not parse CreateUploadURLResponse");
      }
      return response.getUrl();

    } catch (InvalidProtocolBufferException e) {
      throw new IllegalArgumentException(e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



