api/src/main/java/com/google/appengine/api/blobstore/ee10/BlobstoreServiceImpl.java [368:402]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public BlobKey createGsBlobKey(String filename) {

    if (!filename.startsWith("/gs/")) {
      throw new IllegalArgumentException(
          "Google storage filenames must be" + " prefixed with /gs/");
    }
    CreateEncodedGoogleStorageKeyRequest request =
        CreateEncodedGoogleStorageKeyRequest.newBuilder().setFilename(filename).build();

    byte[] responseBytes;
    try {
      responseBytes =
          ApiProxy.makeSyncCall(PACKAGE, "CreateEncodedGoogleStorageKey", request.toByteArray());
    } catch (ApiProxy.ApplicationException ex) {
      switch (BlobstoreServiceError.ErrorCode.forNumber(ex.getApplicationError())) {
        case INTERNAL_ERROR:
          throw new BlobstoreFailureException("An internal blobstore error occurred.");
        default:
          throw new BlobstoreFailureException("An unexpected error occurred.", ex);
      }
    }

    try {
      CreateEncodedGoogleStorageKeyResponse response =
          CreateEncodedGoogleStorageKeyResponse.parseFrom(
              responseBytes, ExtensionRegistry.getEmptyRegistry());
      if (!response.isInitialized()) {
        throw new BlobstoreFailureException(
            "Could not parse CreateEncodedGoogleStorageKeyResponse");
      }
      return new BlobKey(response.getBlobKey());
    } catch (InvalidProtocolBufferException e) {
      throw new IllegalArgumentException(e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



api/src/main/java/com/google/appengine/api/blobstore/BlobstoreServiceImpl.java [361:395]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public BlobKey createGsBlobKey(String filename) {

    if (!filename.startsWith("/gs/")) {
      throw new IllegalArgumentException(
          "Google storage filenames must be" + " prefixed with /gs/");
    }
    CreateEncodedGoogleStorageKeyRequest request =
        CreateEncodedGoogleStorageKeyRequest.newBuilder().setFilename(filename).build();

    byte[] responseBytes;
    try {
      responseBytes =
          ApiProxy.makeSyncCall(PACKAGE, "CreateEncodedGoogleStorageKey", request.toByteArray());
    } catch (ApiProxy.ApplicationException ex) {
      switch (BlobstoreServiceError.ErrorCode.forNumber(ex.getApplicationError())) {
        case INTERNAL_ERROR:
          throw new BlobstoreFailureException("An internal blobstore error occurred.");
        default:
          throw new BlobstoreFailureException("An unexpected error occurred.", ex);
      }
    }

    try {
      CreateEncodedGoogleStorageKeyResponse response =
          CreateEncodedGoogleStorageKeyResponse.parseFrom(
              responseBytes, ExtensionRegistry.getEmptyRegistry());
      if (!response.isInitialized()) {
        throw new BlobstoreFailureException(
            "Could not parse CreateEncodedGoogleStorageKeyResponse");
      }
      return new BlobKey(response.getBlobKey());
    } catch (InvalidProtocolBufferException e) {
      throw new IllegalArgumentException(e);
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



